diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2018-06-19 11:09:39 -0300 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2018-07-01 15:51:13 -0300 |
commit | e0af9ea7a7d7ba2aba76f975bf0d1c9965649ab8 (patch) | |
tree | 27279d0e330d2a4d11cd5163a639ec3921ef215b /src/luarocks/cmd/help.lua | |
parent | 10ee65ec23a9b107c712bd7b017083c9a5571b0c (diff) | |
download | luarocks-e0af9ea7a7d7ba2aba76f975bf0d1c9965649ab8.tar.gz luarocks-e0af9ea7a7d7ba2aba76f975bf0d1c9965649ab8.tar.bz2 luarocks-e0af9ea7a7d7ba2aba76f975bf0d1c9965649ab8.zip |
cmd: new command-line initialization sequence
Diffstat (limited to '')
-rw-r--r-- | src/luarocks/cmd/help.lua | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/luarocks/cmd/help.lua b/src/luarocks/cmd/help.lua index 9e11ad87..1e1d8676 100644 --- a/src/luarocks/cmd/help.lua +++ b/src/luarocks/cmd/help.lua | |||
@@ -40,12 +40,15 @@ end | |||
40 | -- given, help summaries for all commands are shown. | 40 | -- given, help summaries for all commands are shown. |
41 | -- @return boolean or (nil, string): true if there were no errors | 41 | -- @return boolean or (nil, string): true if there were no errors |
42 | -- or nil and an error message if an invalid command was requested. | 42 | -- or nil and an error message if an invalid command was requested. |
43 | function help.command(flags, command) | 43 | function help.command(description, commands, command) |
44 | assert(type(description) == "string") | ||
45 | assert(type(commands) == "table") | ||
46 | |||
44 | if not command then | 47 | if not command then |
45 | local conf = cfg.which_config() | 48 | local conf = cfg.which_config() |
46 | print_banner() | 49 | print_banner() |
47 | print_section("NAME") | 50 | print_section("NAME") |
48 | util.printout("\t"..program..[[ - ]]..program_description) | 51 | util.printout("\t"..program..[[ - ]]..description) |
49 | print_section("SYNOPSIS") | 52 | print_section("SYNOPSIS") |
50 | util.printout("\t"..program..[[ [<flags...>] [VAR=VALUE]... <command> [<argument>] ]]) | 53 | util.printout("\t"..program..[[ [<flags...>] [VAR=VALUE]... <command> [<argument>] ]]) |
51 | print_section("GENERAL OPTIONS") | 54 | print_section("GENERAL OPTIONS") |
@@ -72,8 +75,8 @@ function help.command(flags, command) | |||
72 | Variables from the "variables" table of the configuration file | 75 | Variables from the "variables" table of the configuration file |
73 | can be overriden with VAR=VALUE assignments.]]) | 76 | can be overriden with VAR=VALUE assignments.]]) |
74 | print_section("COMMANDS") | 77 | print_section("COMMANDS") |
75 | for name, command in util.sortedpairs(commands) do | 78 | for name, modname in util.sortedpairs(commands) do |
76 | local cmd = require(command) | 79 | local cmd = require(modname) |
77 | util.printout("", name) | 80 | util.printout("", name) |
78 | util.printout("\t", cmd.help_summary) | 81 | util.printout("\t", cmd.help_summary) |
79 | end | 82 | end |