From e0af9ea7a7d7ba2aba76f975bf0d1c9965649ab8 Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Tue, 19 Jun 2018 11:09:39 -0300 Subject: cmd: new command-line initialization sequence --- src/luarocks/cmd/help.lua | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/luarocks/cmd/help.lua') 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 -- given, help summaries for all commands are shown. -- @return boolean or (nil, string): true if there were no errors -- or nil and an error message if an invalid command was requested. -function help.command(flags, command) +function help.command(description, commands, command) + assert(type(description) == "string") + assert(type(commands) == "table") + if not command then local conf = cfg.which_config() print_banner() print_section("NAME") - util.printout("\t"..program..[[ - ]]..program_description) + util.printout("\t"..program..[[ - ]]..description) print_section("SYNOPSIS") util.printout("\t"..program..[[ [] [VAR=VALUE]... [] ]]) print_section("GENERAL OPTIONS") @@ -72,8 +75,8 @@ function help.command(flags, command) Variables from the "variables" table of the configuration file can be overriden with VAR=VALUE assignments.]]) print_section("COMMANDS") - for name, command in util.sortedpairs(commands) do - local cmd = require(command) + for name, modname in util.sortedpairs(commands) do + local cmd = require(modname) util.printout("", name) util.printout("\t", cmd.help_summary) end -- cgit v1.2.3-55-g6feb