def parse(args)
      if args.size == 1 && args[0].is_a?(String)
        args = Shellwords.shellwords(args[0]) if !Boson.in_shell
        global_opt, parsed_options, args = parse_options args
      # last string argument interpreted as args + options
      elsif args.size > 1 && args[-1].is_a?(String)
        temp_args = Boson.in_shell ? args : Shellwords.shellwords(args.pop)
        global_opt, parsed_options, new_args = parse_options temp_args
        Boson.in_shell ? args = new_args : args += new_args
      # add default options
      elsif @command.options.nil? || @command.options.empty? ||
        (@command.numerical_arg_size? && args.size <= (@command.arg_size - 1).abs) ||
        (@command.has_splat_args? && !args[-1].is_a?(Hash))
          global_opt, parsed_options = parse_options([])[0,2]
      # merge default options with given hash of options
      elsif (@command.has_splat_args? || (args.size == @command.arg_size)) &&
        args[-1].is_a?(Hash)
          global_opt, parsed_options = parse_options([])[0,2]
          parsed_options.merge!(args.pop)
      end
      [global_opt || {}, parsed_options, args]
    end
def parse(args)
      if args.size == 1 && args[0].is_a?(String)
        args = Shellwords.shellwords(args[0]) if !Boson.in_shell
        global_opt, parsed_options, args = parse_options args
      # last string argument interpreted as args + options
      elsif args.size > 1 && args[-1].is_a?(String)
        temp_args = Boson.in_shell ? args : Shellwords.shellwords(args.pop)
        global_opt, parsed_options, new_args = parse_options temp_args
        Boson.in_shell ? args = new_args : args += new_args
      # add default options
      elsif @command.options.nil? || @command.options.empty? ||
        (@command.numerical_arg_size? && args.size <= (@command.arg_size - 1).abs) ||
        (@command.has_splat_args? && !args[-1].is_a?(Hash))
          global_opt, parsed_options = parse_options([])[0,2]
      # merge default options with given hash of options
      elsif (@command.has_splat_args? || (args.size == @command.arg_size)) &&
        args[-1].is_a?(Hash)
          global_opt, parsed_options = parse_options([])[0,2]
          parsed_options.merge!(args.pop)
      end
      [global_opt || {}, parsed_options, args]
    end
Parses arguments and returns global options, local options and leftover
 arguments.