334: def standard_rake_options
335: sort_options(
336: [
337: ['--all', '-A', "Show all tasks, even uncommented ones",
338: lambda { |value|
339: options.show_all_tasks = value
340: }
341: ],
342: ['--backtrace=[OUT]', "Enable full backtrace. OUT can be stderr (default) or stdout.",
343: lambda { |value|
344: options.backtrace = true
345: select_trace_output(options, 'backtrace', value)
346: }
347: ],
348: ['--comments', "Show commented tasks only",
349: lambda { |value|
350: options.show_all_tasks = !value
351: }
352: ],
353: ['--describe', '-D [PATTERN]', "Describe the tasks (matching optional PATTERN), then exit.",
354: lambda { |value|
355: select_tasks_to_show(options, :describe, value)
356: }
357: ],
358: ['--dry-run', '-n', "Do a dry run without executing actions.",
359: lambda { |value|
360: Rake.verbose(true)
361: Rake.nowrite(true)
362: options.dryrun = true
363: options.trace = true
364: }
365: ],
366: ['--execute', '-e CODE', "Execute some Ruby code and exit.",
367: lambda { |value|
368: eval(value)
369: exit
370: }
371: ],
372: ['--execute-print', '-p CODE', "Execute some Ruby code, print the result, then exit.",
373: lambda { |value|
374: puts eval(value)
375: exit
376: }
377: ],
378: ['--execute-continue', '-E CODE',
379: "Execute some Ruby code, then continue with normal task processing.",
380: lambda { |value| eval(value) }
381: ],
382: ['--jobs', '-j [NUMBER]',
383: "Specifies the maximum number of tasks to execute in parallel. (default:2)",
384: lambda { |value| options.thread_pool_size = [(value || 2).to_i,2].max }
385: ],
386: ['--job-stats [LEVEL]',
387: "Display job statistics. LEVEL=history displays a complete job list",
388: lambda { |value|
389: if value =~ /^history/i
390: options.job_stats = :history
391: else
392: options.job_stats = true
393: end
394: }
395: ],
396: ['--libdir', '-I LIBDIR', "Include LIBDIR in the search path for required modules.",
397: lambda { |value| $:.push(value) }
398: ],
399: ['--multitask', '-m', "Treat all tasks as multitasks.",
400: lambda { |value| options.always_multitask = true }
401: ],
402: ['--no-search', '--nosearch', '-N', "Do not search parent directories for the Rakefile.",
403: lambda { |value| options.nosearch = true }
404: ],
405: ['--prereqs', '-P', "Display the tasks and dependencies, then exit.",
406: lambda { |value| options.show_prereqs = true }
407: ],
408: ['--quiet', '-q', "Do not log messages to standard output.",
409: lambda { |value| Rake.verbose(false) }
410: ],
411: ['--rakefile', '-f [FILE]', "Use FILE as the rakefile.",
412: lambda { |value|
413: value ||= ''
414: @rakefiles.clear
415: @rakefiles << value
416: }
417: ],
418: ['--rakelibdir', '--rakelib', '-R RAKELIBDIR',
419: "Auto-import any .rake files in RAKELIBDIR. (default is 'rakelib')",
420: lambda { |value| options.rakelib = value.split(File::PATH_SEPARATOR) }
421: ],
422: ['--require', '-r MODULE', "Require MODULE before executing rakefile.",
423: lambda { |value|
424: begin
425: require value
426: rescue LoadError => ex
427: begin
428: rake_require value
429: rescue LoadError
430: raise ex
431: end
432: end
433: }
434: ],
435: ['--rules', "Trace the rules resolution.",
436: lambda { |value| options.trace_rules = true }
437: ],
438: ['--silent', '-s', "Like --quiet, but also suppresses the 'in directory' announcement.",
439: lambda { |value|
440: Rake.verbose(false)
441: options.silent = true
442: }
443: ],
444: ['--suppress-backtrace PATTERN', "Suppress backtrace lines matching regexp PATTERN. Ignored if --trace is on.",
445: lambda { |value|
446: options.suppress_backtrace_pattern = Regexp.new(value)
447: }
448: ],
449: ['--system', '-g',
450: "Using system wide (global) rakefiles (usually '~/.rake/*.rake').",
451: lambda { |value| options.load_system = true }
452: ],
453: ['--no-system', '--nosystem', '-G',
454: "Use standard project Rakefile search paths, ignore system wide rakefiles.",
455: lambda { |value| options.ignore_system = true }
456: ],
457: ['--tasks', '-T [PATTERN]', "Display the tasks (matching optional PATTERN) with descriptions, then exit.",
458: lambda { |value|
459: select_tasks_to_show(options, :tasks, value)
460: }
461: ],
462: ['--trace=[OUT]', '-t', "Turn on invoke/execute tracing, enable full backtrace. OUT can be stderr (default) or stdout.",
463: lambda { |value|
464: options.trace = true
465: options.backtrace = true
466: select_trace_output(options, 'trace', value)
467: Rake.verbose(true)
468: }
469: ],
470: ['--verbose', '-v', "Log message to standard output.",
471: lambda { |value| Rake.verbose(true) }
472: ],
473: ['--version', '-V', "Display the program version.",
474: lambda { |value|
475: puts "rake, version #{RAKEVERSION}"
476: exit
477: }
478: ],
479: ['--where', '-W [PATTERN]', "Describe the tasks (matching optional PATTERN), then exit.",
480: lambda { |value|
481: select_tasks_to_show(options, :lines, value)
482: options.show_all_tasks = true
483: }
484: ],
485: ['--no-deprecation-warnings', '-X', "Disable the deprecation warnings.",
486: lambda { |value|
487: options.ignore_deprecate = true
488: }
489: ],
490: ])
491: end