diff options
author | dvs1 | 2024-10-25 09:38:35 +1000 |
---|---|---|
committer | dvs1 | 2024-10-25 09:38:35 +1000 |
commit | 31566d68cb3365ead1cdc8648c81d62ce966cb6f (patch) | |
tree | bbe3d4bc790530c6e955e21b18d1150d6036f73a /_.lua | |
parent | Yet another TODO, YATODO. (diff) | |
download | JackOnAllDevices-31566d68cb3365ead1cdc8648c81d62ce966cb6f.zip JackOnAllDevices-31566d68cb3365ead1cdc8648c81d62ce966cb6f.tar.gz JackOnAllDevices-31566d68cb3365ead1cdc8648c81d62ce966cb6f.tar.bz2 JackOnAllDevices-31566d68cb3365ead1cdc8648c81d62ce966cb6f.tar.xz |
Just discovered the arg variable, use it and rename parseArgs() to just parse().
Diffstat (limited to '_.lua')
-rwxr-xr-x | _.lua | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -24,7 +24,7 @@ E = function(s) print('ERROR ' .. s); io.flush() end | |||
24 | C = function(s) print('CRITICAL ' .. s); io.flush() end | 24 | C = function(s) print('CRITICAL ' .. s); io.flush() end |
25 | 25 | ||
26 | 26 | ||
27 | _.parseArgs = function(options, args) | 27 | _.parse = function(args, options) |
28 | --[[ TODO - use this for config files as well. | 28 | --[[ TODO - use this for config files as well. |
29 | An optional argument, the base config file name to look for. In this order, with later ones overriding earlier ones - | 29 | An optional argument, the base config file name to look for. In this order, with later ones overriding earlier ones - |
30 | defaults from the options table | 30 | defaults from the options table |
@@ -34,7 +34,7 @@ _.parseArgs = function(options, args) | |||
34 | ]] | 34 | ]] |
35 | local o = nil | 35 | local o = nil |
36 | if 0 ~= #args then | 36 | if 0 ~= #args then |
37 | for i,a in pairs(args) do | 37 | for i,a in ipairs(args) do |
38 | local s, e = a:find("=") | 38 | local s, e = a:find("=") |
39 | if nil == s then e = 0 end | 39 | if nil == s then e = 0 end |
40 | opt = a:sub(1, e - 1) | 40 | opt = a:sub(1, e - 1) |
@@ -51,7 +51,7 @@ _.parseArgs = function(options, args) | |||
51 | for k, v in pairs(options) do | 51 | for k, v in pairs(options) do |
52 | h = h .. k .. ' | ' | 52 | h = h .. k .. ' | ' |
53 | end | 53 | end |
54 | print('Usage: aataaj.lua {' .. string.sub(h, 1, -2) .. '}') | 54 | print('Usage: ' .. args[0] .. ' {' .. string.sub(h, 1, -2) .. '}') |
55 | os.exit(0) | 55 | os.exit(0) |
56 | end | 56 | end |
57 | end | 57 | end |