def parse_options
      config = {}

      begin
        OptionParser.new do |opts|
          opts.on('-c', '--config_path PATH',
                  'Parse options from file (will get overriden by flags)') do |file|
            Spinach.config[:config_path] = file
          end

          opts.on('-b', '--backtrace',
                  'Show backtrace of errors') do |show_backtrace|
            config[:reporter_options] = {backtrace: show_backtrace}
          end

          opts.on('-t', '--tags TAG',
                  'Run all scenarios for given tags.') do |tag|
            config[:tags] ||= []
            tags = tag.delete('@').split(',')

            if (config[:tags] + tags).flatten.none? { |t| t =~ /wip$/ }
              tags.unshift '~wip'
            end

            config[:tags] << tags
          end

          opts.on('-g', '--generate',
                  'Auto-generate the feature steps files') do
            config[:generate] = true
          end

          opts.on_tail('--version', 'Show version') do
            puts Spinach::VERSION
            exit
          end

          opts.on('-f', '--features_path PATH',
                  'Path where your features will be searched for') do |path|
            config[:features_path] = path
          end

          opts.on('-r', '--reporter CLASS_NAMES',
                  'Formatter class names, separated by commas') do |class_names|
            names = class_names.split(',').map { |c| reporter_class(c) }
            config[:reporter_classes] = names
          end

          opts.on('--rand', "Randomize the order of features and scenarios") do
            config[:orderer_class] = orderer_class(:random)
          end

          opts.on('--seed SEED', Integer,
                  "Provide a seed for randomizing the order of features and scenarios") do |seed|
            config[:orderer_class] = orderer_class(:random)
            config[:seed]          = seed
          end

          opts.on_tail('--fail-fast',
                       'Terminate the suite run on the first failure') do |class_name|
            config[:fail_fast] = true
          end

          opts.on('-a', '--audit',
                  "Audit steps instead of running them, outputting missing \
and obsolete steps") do
            config[:audit] = true
          end
        end.parse!(@args)

        Spinach.config.parse_from_file
        config.each{|k,v| Spinach.config[k] = v}
        if Spinach.config.tags.empty? ||
          Spinach.config.tags.flatten.none?{ |t| t =~ /wip$/ }
          Spinach.config.tags.unshift ['~wip']
        end
      rescue OptionParser::ParseError => exception
        puts exception.message.capitalize
        exit 1
      end
    end
def parse_options
      config = {}

      begin
        OptionParser.new do |opts|
          opts.on('-c', '--config_path PATH',
                  'Parse options from file (will get overriden by flags)') do |file|
            Spinach.config[:config_path] = file
          end

          opts.on('-b', '--backtrace',
                  'Show backtrace of errors') do |show_backtrace|
            config[:reporter_options] = {backtrace: show_backtrace}
          end

          opts.on('-t', '--tags TAG',
                  'Run all scenarios for given tags.') do |tag|
            config[:tags] ||= []
            tags = tag.delete('@').split(',')

            if (config[:tags] + tags).flatten.none? { |t| t =~ /wip$/ }
              tags.unshift '~wip'
            end

            config[:tags] << tags
          end

          opts.on('-g', '--generate',
                  'Auto-generate the feature steps files') do
            config[:generate] = true
          end

          opts.on_tail('--version', 'Show version') do
            puts Spinach::VERSION
            exit
          end

          opts.on('-f', '--features_path PATH',
                  'Path where your features will be searched for') do |path|
            config[:features_path] = path
          end

          opts.on('-r', '--reporter CLASS_NAMES',
                  'Formatter class names, separated by commas') do |class_names|
            names = class_names.split(',').map { |c| reporter_class(c) }
            config[:reporter_classes] = names
          end

          opts.on('--rand', "Randomize the order of features and scenarios") do
            config[:orderer_class] = orderer_class(:random)
          end

          opts.on('--seed SEED', Integer,
                  "Provide a seed for randomizing the order of features and scenarios") do |seed|
            config[:orderer_class] = orderer_class(:random)
            config[:seed]          = seed
          end

          opts.on_tail('--fail-fast',
                       'Terminate the suite run on the first failure') do |class_name|
            config[:fail_fast] = true
          end

          opts.on('-a', '--audit',
                  "Audit steps instead of running them, outputting missing \
and obsolete steps") do
            config[:audit] = true
          end
        end.parse!(@args)

        Spinach.config.parse_from_file
        config.each{|k,v| Spinach.config[k] = v}
        if Spinach.config.tags.empty? ||
          Spinach.config.tags.flatten.none?{ |t| t =~ /wip$/ }
          Spinach.config.tags.unshift ['~wip']
        end
      rescue OptionParser::ParseError => exception
        puts exception.message.capitalize
        exit 1
      end
    end
Parses the arguments into options.

 @return [Hash]
   A hash of options separated by its type.

 @api private