class Rake::Application

def standard_rake_options

passing to OptionParser.
A list of all the standard options used in rake, suitable for
def standard_rake_options
  [
    ['--classic-namespace', '-C', "Put Task and FileTask in the top level namespace",
      lambda { |value|
        require 'rake/classic_namespace'
        options.classic_namespace = true
      }
    ],
    ['--describe', '-D [PATTERN]', "Describe the tasks (matching optional PATTERN), then exit.",
      lambda { |value|
        options.show_tasks = true
        options.full_description = true
        options.show_task_pattern = Regexp.new(value || '')
      }
    ],
    ['--dry-run', '-n', "Do a dry run without executing actions.",
      lambda { |value|
        verbose(true)
        nowrite(true)
        options.dryrun = true
        options.trace = true
      }
    ],
    ['--execute',  '-e CODE', "Execute some Ruby code and exit.",
      lambda { |value|
        eval(value)
        exit
      }
    ],
    ['--execute-print',  '-p CODE', "Execute some Ruby code, print the result, then exit.",
      lambda { |value|
        puts eval(value)
        exit
      }
    ],
    ['--execute-continue',  '-E CODE',
      "Execute some Ruby code, then continue with normal task processing.",
      lambda { |value| eval(value) }            
    ],
    ['--libdir', '-I LIBDIR', "Include LIBDIR in the search path for required modules.",
      lambda { |value| $:.push(value) }
    ],
    ['--prereqs', '-P', "Display the tasks and dependencies, then exit.",
      lambda { |value| options.show_prereqs = true }
    ],
    ['--quiet', '-q', "Do not log messages to standard output.",
      lambda { |value| verbose(false) }
    ],
    ['--rakefile', '-f [FILE]', "Use FILE as the rakefile.",
      lambda { |value| 
        value ||= ''
        @rakefiles.clear 
        @rakefiles << value
      }
    ],
    ['--rakelibdir', '--rakelib', '-R RAKELIBDIR',
      "Auto-import any .rake files in RAKELIBDIR. (default is 'rakelib')",
      lambda { |value| options.rakelib = value.split(':') }
    ],
    ['--require', '-r MODULE', "Require MODULE before executing rakefile.",
      lambda { |value|
        begin
          require value
        rescue LoadError => ex
          begin
            rake_require value
          rescue LoadError => ex2
            raise ex
          end
        end
      }
    ],
    ['--rules', "Trace the rules resolution.",
      lambda { |value| options.trace_rules = true }
    ],
    ['--no-search', '--nosearch', '-N', "Do not search parent directories for the Rakefile.",
      lambda { |value| options.nosearch = true }
    ],
    ['--silent', '-s', "Like --quiet, but also suppresses the 'in directory' announcement.",
      lambda { |value|
        verbose(false)
        options.silent = true
      }
    ],
    ['--system',  '-g',
      "Using system wide (global) rakefiles (usually '~/.rake/*.rake').",
      lambda { |value| options.load_system = true }
    ],
    ['--no-system', '--nosystem', '-G',
      "Use standard project Rakefile search paths, ignore system wide rakefiles.",
      lambda { |value| options.ignore_system = true }
    ],
    ['--tasks', '-T [PATTERN]', "Display the tasks (matching optional PATTERN) with descriptions, then exit.",
      lambda { |value|
        options.show_tasks = true
        options.show_task_pattern = Regexp.new(value || '')
        options.full_description = false
      }
    ],
    ['--trace', '-t', "Turn on invoke/execute tracing, enable full backtrace.",
      lambda { |value|
        options.trace = true
        verbose(true)
      }
    ],
    ['--verbose', '-v', "Log message to standard output.",
      lambda { |value| verbose(true) }
    ],
    ['--version', '-V', "Display the program version.",
      lambda { |value|
        puts "rake, version #{RAKEVERSION}"
        exit
      }
    ]
  ]
end