lib/mothership.rb in mothership-0.3.2 vs lib/mothership.rb in mothership-0.3.3
- old
+ new
@@ -25,22 +25,25 @@
# first, and the bits left over will be treated as arguments
def start(argv)
global_parser = Parser.new(@@global)
name, *argv = global_parser.parse_flags(argv, @@commands)
- global = new
- global.input = Inputs.new(@@global, global, global_parser)
+ global = new(@@global)
+ global.input = Inputs.new(@@global, global, {}, global_parser.given)
return global.default_action unless name
cmdname = name.gsub("-", "_").to_sym
cmd = @@commands[cmdname]
return global.unknown_command(cmdname) unless cmd
ctx = cmd.context.new
+
+ # make global input available for those wrapping execute
ctx.input = global.input
- ctx.execute(cmd, argv, global_parser.given)
+
+ ctx.execute(cmd, argv, global.input)
code = @@exit_status
# reset exit status
@@exit_status = 0