# File lib/webby/apps/main.rb, line 39
  def parse( args )
    opts = OptionParser.new
    opts.banner = 'Usage: webby [options] target [target args]'

    opts.separator ''

    desired_opts = %[--describe --prereqs --tasks --trace]
    app.standard_rake_options.each do |options|
      next unless desired_opts.include?(options.first)
      opts.on(*options)
    end
    opts.on('-o', '--options [PATTERN]',
            'Show configuration options (matching optional pattern), then exit.') { |value|
      @command = [:show_options, value]
    }

    opts.separator ''
    opts.separator 'autobuild options:'

    opts.on('--web-server', 'Start a local web server') {
      cmd_line_options[:use_web_server] = true
    }
    opts.on('--no-web-server', 'Do not start a local web server') {
      cmd_line_options[:use_web_server] = false
    }

    opts.separator ''
    opts.separator 'common options:'

    opts.on_tail( '-h', '--help', 'show this message' ) do
      @stdout.puts opts
      exit
    end
    opts.on_tail( '--version', 'show version' ) do
      @stdout.puts "Webby #{::Webby::VERSION}"
      exit
    end

    opts.parse! args

    ARGV.replace Array(args.shift)
    args.delete_if do |arg|
      if %r/^[A-Z_]+=/ =~ arg
        ARGV << arg
        next true
      end
      false
    end

    args
  end