diff options
author | dvs1 | 2024-11-04 15:55:12 +1000 |
---|---|---|
committer | dvs1 | 2024-11-04 15:55:12 +1000 |
commit | 04fdaba85854140264ce787142d52455a99e4764 (patch) | |
tree | cf95d45464d430056c93ce3a9c9ee264f7025521 /PolygLua.lua | |
parent | Switch confFile to name, to be used more genericaly. (diff) | |
download | JackOnAllDevices-04fdaba85854140264ce787142d52455a99e4764.zip JackOnAllDevices-04fdaba85854140264ce787142d52455a99e4764.tar.gz JackOnAllDevices-04fdaba85854140264ce787142d52455a99e4764.tar.bz2 JackOnAllDevices-04fdaba85854140264ce787142d52455a99e4764.tar.xz |
Pass name to option funcs, and use it in help command.
Diffstat (limited to '')
-rwxr-xr-x | PolygLua.lua | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/PolygLua.lua b/PolygLua.lua index 77f01f4..17abd88 100755 --- a/PolygLua.lua +++ b/PolygLua.lua | |||
@@ -41,8 +41,8 @@ _G.C = function(s) log(-1, 'CRITICAL ', s) end | |||
41 | local optionsCommon = | 41 | local optionsCommon = |
42 | { | 42 | { |
43 | help = {help = 'Print the help text.', | 43 | help = {help = 'Print the help text.', |
44 | func = function(self, options, a, args, i) | 44 | func = function(self, options, a, args, i, name) |
45 | for i,v in ipairs{'/usr/share/doc/', '/usr/local/share/doc/', './'} do | 45 | for i,v in ipairs{'/usr/share/doc/' .. name, '/usr/local/share/doc/' .. name, './'} do |
46 | local p = v .. 'README.md' | 46 | local p = v .. 'README.md' |
47 | local h = io.open(p, 'r') | 47 | local h = io.open(p, 'r') |
48 | if nil ~= h then | 48 | if nil ~= h then |
@@ -108,7 +108,7 @@ _.parse = function(args, options, name) | |||
108 | if nil == o then o = optionsCommon[name] end | 108 | if nil == o then o = optionsCommon[name] end |
109 | if nil ~= o then | 109 | if nil ~= o then |
110 | if nil ~= val then o.value = val; D(name .. ' = ' .. tostring(val)) end | 110 | if nil ~= val then o.value = val; D(name .. ' = ' .. tostring(val)) end |
111 | if nil ~= o.func then o:func(options, a, args, i) end | 111 | if nil ~= o.func then o:func(options, a, args, i, name) end |
112 | end | 112 | end |
113 | return o | 113 | return o |
114 | end | 114 | end |