def commandify(obj, hash)
      raise ArgumentError, ":name required" unless hash[:name]
      hash[:arg_size] ||= '*'
      hash[:has_splat_args?] = true if hash[:arg_size] == '*'
      fake_cmd = OpenStruct.new(hash)
      fake_cmd.option_parser ||= OptionParser.new(fake_cmd.options || {})
      redefine_command(obj, fake_cmd)
    end
def commandify(obj, hash)
      raise ArgumentError, ":name required" unless hash[:name]
      hash[:arg_size] ||= '*'
      hash[:has_splat_args?] = true if hash[:arg_size] == '*'
      fake_cmd = OpenStruct.new(hash)
      fake_cmd.option_parser ||= OptionParser.new(fake_cmd.options || {})
      redefine_command(obj, fake_cmd)
    end
A wrapper around redefine_command that doesn't depend on a Command object.
 Rather you simply pass a hash of command attributes (see Command.new) or
 command methods and let OpenStruct mock a command.  The only required
 attribute is :name, though to get any real use you should define :options
 and :arg_size (default is '*'). Example:
   >> def checkit(*args); args; end
   => nil
   >> Boson::Scientist.commandify(self, :name=>'checkit', :options=>{:verbose=>:boolean, :num=>:numeric})
   => ['checkit']
   # regular ruby method
   >> checkit 'one', 'two', :num=>13, :verbose=>true
   => ["one", "two", {:num=>13, :verbose=>true}]
   # commandline ruby method
   >> checkit 'one two -v -n=13'
   => ["one", "two", {:num=>13, :verbose=>true}]