diff options
author | mpeterv <petjamelnik@yandex.ru> | 2014-03-20 22:07:34 +0400 |
---|---|---|
committer | mpeterv <petjamelnik@yandex.ru> | 2014-03-20 22:07:34 +0400 |
commit | b63e863cf3ac9c830c5c81ece8e30f91edba4adc (patch) | |
tree | 792c79ee5573ba1a07175158efdd89a172231347 | |
parent | 066269a92b7d9cd7299188fea81a2ab9d16285d9 (diff) | |
download | luarocks-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.lua | 7 | ||||
-rw-r--r-- | 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 @@ | |||
1 | 1 | ||
2 | --- Functions for command-line scripts. | 2 | --- Functions for command-line scripts. |
3 | module("luarocks.command_line", package.seeall) | 3 | --module("luarocks.command_line", package.seeall) |
4 | local command_line = {} | ||
4 | 5 | ||
5 | local util = require("luarocks.util") | 6 | local util = require("luarocks.util") |
6 | local cfg = require("luarocks.cfg") | 7 | local 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. |
46 | function run_command(...) | 47 | function 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() |
208 | end | 209 | end |
210 | |||
211 | 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 @@ | |||
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. |
7 | module("luarocks.help", package.seeall) | 7 | --module("luarocks.help", package.seeall) |
8 | local help = {} | ||
8 | 9 | ||
9 | local util = require("luarocks.util") | 10 | local util = require("luarocks.util") |
10 | local cfg = require("luarocks.cfg") | 11 | local cfg = require("luarocks.cfg") |
@@ -12,10 +13,10 @@ local dir = require("luarocks.dir") | |||
12 | 13 | ||
13 | local program = util.this_program("luarocks") | 14 | local program = util.this_program("luarocks") |
14 | 15 | ||
15 | help_summary = "Help on commands. Type '"..program.." help <command>' for more." | 16 | help.help_summary = "Help on commands. Type '"..program.." help <command>' for more." |
16 | 17 | ||
17 | help_arguments = "[<command>]" | 18 | help.help_arguments = "[<command>]" |
18 | help = [[ | 19 | help.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. |
45 | function run(...) | 46 | function 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 |
116 | end | 117 | end |
118 | |||
119 | return help | ||