aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormpeterv <petjamelnik@yandex.ru>2014-03-20 22:07:34 +0400
committermpeterv <petjamelnik@yandex.ru>2014-03-20 22:07:34 +0400
commitb63e863cf3ac9c830c5c81ece8e30f91edba4adc (patch)
tree792c79ee5573ba1a07175158efdd89a172231347
parent066269a92b7d9cd7299188fea81a2ab9d16285d9 (diff)
downloadluarocks-b63e863cf3ac9c830c5c81ece8e30f91edba4adc.tar.gz
luarocks-b63e863cf3ac9c830c5c81ece8e30f91edba4adc.tar.bz2
luarocks-b63e863cf3ac9c830c5c81ece8e30f91edba4adc.zip
Unmoduled CLI-related modules which used some globals
-rw-r--r--src/luarocks/command_line.lua7
-rw-r--r--src/luarocks/help.lua13
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 @@
1 1
2--- Functions for command-line scripts. 2--- Functions for command-line scripts.
3module("luarocks.command_line", package.seeall) 3--module("luarocks.command_line", package.seeall)
4local command_line = {}
4 5
5local util = require("luarocks.util") 6local util = require("luarocks.util")
6local cfg = require("luarocks.cfg") 7local cfg = require("luarocks.cfg")
@@ -43,7 +44,7 @@ end
43-- Uses the global table "commands", which contains 44-- Uses the global table "commands", which contains
44-- the loaded modules representing commands. 45-- the loaded modules representing commands.
45-- @param ... string: Arguments given on the command-line. 46-- @param ... string: Arguments given on the command-line.
46function run_command(...) 47function command_line.run_command(...)
47 local args = {...} 48 local args = {...}
48 local cmdline_vars = {} 49 local cmdline_vars = {}
49 for i = #args, 1, -1 do 50 for i = #args, 1, -1 do
@@ -206,3 +207,5 @@ function run_command(...)
206 end 207 end
207 util.run_scheduled_functions() 208 util.run_scheduled_functions()
208end 209end
210
211return 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 @@
4-- uses a global table called "commands" to find commands 4-- uses a global table called "commands" to find commands
5-- to show help for; each command should be represented by a 5-- to show help for; each command should be represented by a
6-- table containing "help" and "help_summary" fields. 6-- table containing "help" and "help_summary" fields.
7module("luarocks.help", package.seeall) 7--module("luarocks.help", package.seeall)
8local help = {}
8 9
9local util = require("luarocks.util") 10local util = require("luarocks.util")
10local cfg = require("luarocks.cfg") 11local cfg = require("luarocks.cfg")
@@ -12,10 +13,10 @@ local dir = require("luarocks.dir")
12 13
13local program = util.this_program("luarocks") 14local program = util.this_program("luarocks")
14 15
15help_summary = "Help on commands. Type '"..program.." help <command>' for more." 16help.help_summary = "Help on commands. Type '"..program.." help <command>' for more."
16 17
17help_arguments = "[<command>]" 18help.help_arguments = "[<command>]"
18help = [[ 19help.help = [[
19<command> is the command to show help for. 20<command> is the command to show help for.
20]] 21]]
21 22
@@ -42,7 +43,7 @@ end
42-- given, help summaries for all commands are shown. 43-- given, help summaries for all commands are shown.
43-- @return boolean or (nil, string): true if there were no errors 44-- @return boolean or (nil, string): true if there were no errors
44-- or nil and an error message if an invalid command was requested. 45-- or nil and an error message if an invalid command was requested.
45function run(...) 46function help.run(...)
46 local flags, command = util.parse_flags(...) 47 local flags, command = util.parse_flags(...)
47 48
48 if not command then 49 if not command then
@@ -114,3 +115,5 @@ function run(...)
114 end 115 end
115 return true 116 return true
116end 117end
118
119return help