From dede5ff5a56eb1d2ddb13ca7450e00cd8d6562dd Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Fri, 12 Apr 2013 14:11:02 -0300 Subject: Handle verbosity with a config option (now it can be set through the config file) --- src/luarocks/fs/lua.lua | 1 + src/luarocks/fs/win32/tools.lua | 9 ++------- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/luarocks/fs/lua.lua b/src/luarocks/fs/lua.lua index d6795773..36b33690 100644 --- a/src/luarocks/fs/lua.lua +++ b/src/luarocks/fs/lua.lua @@ -129,6 +129,7 @@ if lfs_ok then -- @return boolean: true if command succeeds (status code 0), false -- otherwise. function execute_string(cmd) + if cfg.verbose then print("Executing: "..cmd) end local code = os.execute(cmd) if code == 0 or code == true then return true diff --git a/src/luarocks/fs/win32/tools.lua b/src/luarocks/fs/win32/tools.lua index e32b8280..eabf125e 100644 --- a/src/luarocks/fs/win32/tools.lua +++ b/src/luarocks/fs/win32/tools.lua @@ -4,11 +4,6 @@ -- used by this module. module("luarocks.fs.win32.tools", package.seeall) - ---uncomment following line to make executed commands and results visible ---TODO: make commandline option ---local verbose = true - local fs = require("luarocks.fs") local dir = require("luarocks.dir") local cfg = require("luarocks.cfg") @@ -61,9 +56,9 @@ end -- otherwise. function execute_string(cmd) cmd = command_at(fs.current_dir(), cmd) - if verbose then print("Executing: "..tostring(cmd)) end + if cfg.verbose then print("Executing: "..tostring(cmd) end local code = pack(os.execute(cmd)) - if verbose then + if cfg.verbose then print("Results: "..tostring(code.n)) for i = 1,code.n do print(" "..tostring(i).." ("..type(code[i]).."): "..tostring(code[i])) -- cgit v1.2.3-55-g6feb