lib/rbbt/util/cmd.rb in rbbt-util-5.26.93 vs lib/rbbt/util/cmd.rb in rbbt-util-5.26.97

- old
+ new

@@ -4,23 +4,23 @@ require 'rbbt/util/misc/indiferent_hash' module CMD TOOLS = IndiferentHash.setup({}) - def self.tool(tool, claim = nil, test = nil, &block) - TOOLS[tool] = [claim, test, block] + def self.tool(tool, claim = nil, test = nil, cmd = nil, &block) + TOOLS[tool] = [claim, test, block, cmd] end def self.get_tool(tool) return tool.to_s unless TOOLS[tool] @@init_cmd_tool ||= IndiferentHash.setup({}) if !@@init_cmd_tool[tool] - claim, test, block = TOOLS[tool] + claim, test, block, cmd = TOOLS[tool] begin if test - CMD.cmd(test) + CMD.cmd(test + " ") else CMD.cmd("#{tool} --help") end rescue if claim @@ -28,9 +28,11 @@ else block.call end end @@init_cmd_tool[tool] = true + + return cmd if cmd end tool.to_s end