From b63e863cf3ac9c830c5c81ece8e30f91edba4adc Mon Sep 17 00:00:00 2001 From: mpeterv Date: Thu, 20 Mar 2014 22:07:34 +0400 Subject: Unmoduled CLI-related modules which used some globals --- src/luarocks/command_line.lua | 7 +++++-- src/luarocks/help.lua | 13 ++++++++----- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/luarocks/command_line.lua b/src/luarocks/command_line.lua index 1c29aa77..54d64787 100644 --- a/src/luarocks/command_line.lua +++ b/src/luarocks/command_line.lua @@ -1,6 +1,7 @@ --- Functions for command-line scripts. -module("luarocks.command_line", package.seeall) +--module("luarocks.command_line", package.seeall) +local command_line = {} local util = require("luarocks.util") local cfg = require("luarocks.cfg") @@ -43,7 +44,7 @@ end -- Uses the global table "commands", which contains -- the loaded modules representing commands. -- @param ... string: Arguments given on the command-line. -function run_command(...) +function command_line.run_command(...) local args = {...} local cmdline_vars = {} for i = #args, 1, -1 do @@ -206,3 +207,5 @@ function run_command(...) end util.run_scheduled_functions() end + +return command_line diff --git a/src/luarocks/help.lua b/src/luarocks/help.lua index 9f622f96..3e428a4a 100644 --- a/src/luarocks/help.lua +++ b/src/luarocks/help.lua @@ -4,7 +4,8 @@ -- uses a global table called "commands" to find commands -- to show help for; each command should be represented by a -- table containing "help" and "help_summary" fields. -module("luarocks.help", package.seeall) +--module("luarocks.help", package.seeall) +local help = {} local util = require("luarocks.util") local cfg = require("luarocks.cfg") @@ -12,10 +13,10 @@ local dir = require("luarocks.dir") local program = util.this_program("luarocks") -help_summary = "Help on commands. Type '"..program.." help ' for more." +help.help_summary = "Help on commands. Type '"..program.." help ' for more." -help_arguments = "[]" -help = [[ +help.help_arguments = "[]" +help.help = [[ is the command to show help for. ]] @@ -42,7 +43,7 @@ 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 run(...) +function help.run(...) local flags, command = util.parse_flags(...) if not command then @@ -114,3 +115,5 @@ function run(...) end return true end + +return help -- cgit v1.2.3-55-g6feb