OctOS: Allow specifying command to get help for with help command
parent
c4bd091ae8
commit
662c265cab
|
@ -2,16 +2,28 @@
|
|||
|
||||
local params = ...
|
||||
local bin = get_userdata("bin")
|
||||
local param = params[1]
|
||||
|
||||
if params[1] == "all" then
|
||||
for name, info in pairs(bin) do
|
||||
local params = ""
|
||||
if info.params then
|
||||
params = " "..info.params
|
||||
end
|
||||
|
||||
print(name..params..": "..info.description)
|
||||
-- [local function] Print help
|
||||
local function print_h(name, info)
|
||||
local params = ""
|
||||
if info.params then
|
||||
params = " "..info.params
|
||||
end
|
||||
|
||||
print(name..params..": "..info.description)
|
||||
end
|
||||
|
||||
if param == "all" then
|
||||
for name, info in pairs(bin) do
|
||||
print_h(name, info)
|
||||
end
|
||||
elseif not param or param == "" then
|
||||
print("Specify a command to get help for or use help all to view help for all commands.")
|
||||
else
|
||||
if bin[param] then
|
||||
print_h(param, bin[param])
|
||||
else
|
||||
print(param..": command not found")
|
||||
end
|
||||
else
|
||||
print("Specify a command to get help for or use help all to view help for all commands.")
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue