def option(option, *args)
      options = args.pop if args.last.is_a?(Hash)
      options ||= {}
      raise "Invalid number of arguments (0 or 1 expected)" if args.size > 1
      return unless @shell.applicable?(options)
      value = args.shift || options[:value]
      if options[:os_prefix]
        option = @shell.option_switch + option
      else
        option = option.dup
      end
      if @shell.requires_escaping?(option)
        option = @shell.escape_value(option)
      end
      option << ' ' << @shell.escape_value(value) if value
      option << @shell.escape_value(options[:join_value]) if options[:join_value]
      option << '=' << @shell.escape_value(options[:equal_value]) if options[:equal_value]
      if file = options[:file]
        file_sep = ' '
      elsif file = options[:join_file]
        file_sep = ''
      elsif file = options[:equal_file]
        file_sep = '='
      end
      if file
        option << file_sep << @shell.escape_filename(file)
      end
      @command << ' ' << option
      @last_arg = :option
    end
def option(option, *args)
      options = args.pop if args.last.is_a?(Hash)
      options ||= {}
      raise "Invalid number of arguments (0 or 1 expected)" if args.size > 1
      return unless @shell.applicable?(options)
      value = args.shift || options[:value]
      if options[:os_prefix]
        option = @shell.option_switch + option
      else
        option = option.dup
      end
      if @shell.requires_escaping?(option)
        option = @shell.escape_value(option)
      end
      option << ' ' << @shell.escape_value(value) if value
      option << @shell.escape_value(options[:join_value]) if options[:join_value]
      option << '=' << @shell.escape_value(options[:equal_value]) if options[:equal_value]
      if file = options[:file]
        file_sep = ' '
      elsif file = options[:join_file]
        file_sep = ''
      elsif file = options[:equal_file]
        file_sep = '='
      end
      if file
        option << file_sep << @shell.escape_filename(file)
      end
      @command << ' ' << option
      @last_arg = :option
    end
Add an option to the command.

     option '-x'    # flag-style option
     option '--y'   # long option
     option '/z'    # Windows-style option
     options 'abc'  # unprefixed option

 If the option +:os_prefix+ is true
 then the default system option switch will be used.

     option 'x', os_prefix: true # will produce -x or /x

 A value can be given as an option and will be space-separated from
 the option name:

     option '-x', value: 123 # -x 123

 To avoid spacing the value use the +:join_value+ option

     option '-x', join_value: 123 # -x123

 And to use an equal sign as separator, use +:equal_value+

     option '-x', equal_value: 123 # -x=123

 If the option value is a file name, use the analogous
 +:file+, +:join_file+ or +:equal_file+ options:

     option '-i', file: 'path/filename'

 Several of this options can be given simoultaneusly:

     option '-d', join_value: 'x', equal_value: '1' # -dx=1