From cdda7a8b924fd73682183ee8b29215e703bbb52f Mon Sep 17 00:00:00 2001 From: Paul Ouellette Date: Fri, 2 Aug 2019 00:59:52 -0400 Subject: Fix epilog not showing with `luarocks help` Argparse will print the help when we call :parse(), so the epilog has to be set at that time. We also want to show an up to date config text when using `luarocks`, so update the epilog then. --- src/luarocks/cmd.lua | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/luarocks/cmd.lua b/src/luarocks/cmd.lua index 26780eed..0bbb9715 100644 --- a/src/luarocks/cmd.lua +++ b/src/luarocks/cmd.lua @@ -338,10 +338,17 @@ local function get_config_text(cfg) end local function get_parser(description, cmd_modules) + local epilog = [[ +Variables: + Variables from the "variables" table of the configuration file can be + overridden with VAR=VALUE assignments. + +]]..get_config_text(cfg) + local basename = dir.base_name(program) local parser = argparse( basename, "LuaRocks "..cfg.program_version..", the Lua package manager\n\n".. - program.." - "..description) + program.." - "..description, epilog) :help_max_width(80) :add_help("--help") :add_help_command() @@ -557,14 +564,15 @@ function cmd.run_command(description, commands, external_namespace, ...) cfg.local_cache = dir.path(fs.system_cache_dir(), "luarocks") end - parser:epilog([[ + if not args.command then + -- Update the config text + parser:epilog([[ Variables: Variables from the "variables" table of the configuration file can be overridden with VAR=VALUE assignments. ]]..get_config_text(cfg)) - if not args.command then util.printout() util.printout(parser:get_help()) util.printout() -- cgit v1.2.3-55-g6feb