Skip to content

Instantly share code, notes, and snippets.

@pine
Last active November 18, 2015 00:05
Show Gist options
  • Save pine/e3ba9f7e7a27f313b051 to your computer and use it in GitHub Desktop.
Save pine/e3ba9f7e7a27f313b051 to your computer and use it in GitHub Desktop.
uru command for NYAGOS. Please put uru_rt.exe file in PATH. License: Public Domain.
nyagos.alias('uru', function(args)
local uruargs = { 'uru_rt' }
for index, value in ipairs(args) do
table.insert(uruargs, '"'..value..'"')
end
nyagos.setenv('URU_INVOKER', 'batch')
local ok, err = nyagos.exec(table.concat(uruargs, ' '))
if not ok then
print(err)
return
end
local uruhome = os.getenv('URU_HOME')
if not uruhome then
uruhome = os.getenv('USERPROFILE')..'\\.uru'
end
local urulackee = uruhome..'\\uru_lackee.bat'
local fd = io.open(urulackee, 'r')
if not fd then return end
for line in fd:lines() do
local name, value = string.match(line, '^SET%s+([%w_]+)=(.*)$')
if name then
nyagos.setenv(name, value)
end
end
io.close(fd)
end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment