diff options
author | Thijs Schreijer <thijs@thijsschreijer.nl> | 2013-12-22 08:25:09 +0100 |
---|---|---|
committer | Thijs Schreijer <thijs@thijsschreijer.nl> | 2013-12-22 08:25:09 +0100 |
commit | c04e89b2084843256117dfe045393391a7384a74 (patch) | |
tree | dac35501c76f13435d0fe684b3824e06d47cc43a | |
parent | c05ebc07763f94c1adfd4c201a805b66e8d98097 (diff) | |
download | luarocks-c04e89b2084843256117dfe045393391a7384a74.tar.gz luarocks-c04e89b2084843256117dfe045393391a7384a74.tar.bz2 luarocks-c04e89b2084843256117dfe045393391a7384a74.zip |
adds flag `--verbose` as equivalent for config file `verbose = true`
-rw-r--r-- | src/luarocks/command_line.lua | 6 | ||||
-rw-r--r-- | src/luarocks/fs.lua | 5 |
2 files changed, 10 insertions, 1 deletions
diff --git a/src/luarocks/command_line.lua b/src/luarocks/command_line.lua index 63b918b5..059b7a1c 100644 --- a/src/luarocks/command_line.lua +++ b/src/luarocks/command_line.lua | |||
@@ -61,6 +61,12 @@ function run_command(...) | |||
61 | 61 | ||
62 | local command | 62 | local command |
63 | 63 | ||
64 | if flags["verbose"] then -- setting it in the config file will kick-in earlier in the process | ||
65 | cfg.verbose = true | ||
66 | local fs = require("luarocks.fs") | ||
67 | fs.verbose() | ||
68 | end | ||
69 | |||
64 | if flags["version"] then | 70 | if flags["version"] then |
65 | util.printout(program.." "..cfg.program_version) | 71 | util.printout(program.." "..cfg.program_version) |
66 | util.printout(program_description) | 72 | util.printout(program_description) |
diff --git a/src/luarocks/fs.lua b/src/luarocks/fs.lua index 2d799da2..b281eb14 100644 --- a/src/luarocks/fs.lua +++ b/src/luarocks/fs.lua | |||
@@ -14,7 +14,9 @@ local cfg = require("luarocks.cfg") | |||
14 | local pack = table.pack or function(...) return { n = select("#", ...), ... } end | 14 | local pack = table.pack or function(...) return { n = select("#", ...), ... } end |
15 | local unpack = table.unpack or unpack | 15 | local unpack = table.unpack or unpack |
16 | 16 | ||
17 | if cfg.verbose then -- patch io.popen and os.execute to display commands in verbose mode | 17 | local old_popen, old_exec |
18 | _M.verbose = function() -- patch io.popen and os.execute to display commands in verbose mode | ||
19 | if old_popen or old_exec then return end | ||
18 | old_popen = io.popen | 20 | old_popen = io.popen |
19 | io.popen = function(one, two) | 21 | io.popen = function(one, two) |
20 | if two == nil then | 22 | if two == nil then |
@@ -36,6 +38,7 @@ if cfg.verbose then -- patch io.popen and os.execute to display commands in verb | |||
36 | return unpack(code, 1, code.n) | 38 | return unpack(code, 1, code.n) |
37 | end | 39 | end |
38 | end | 40 | end |
41 | if cfg.verbose then _M.verbose() end | ||
39 | 42 | ||
40 | local function load_fns(fs_table) | 43 | local function load_fns(fs_table) |
41 | for name, fn in pairs(fs_table) do | 44 | for name, fn in pairs(fs_table) do |