286: def standard_rake_options
287: [
288: ['--classic-namespace', '-C', "Put Task and FileTask in the top level namespace",
289: lambda { |value|
290: require 'rake/classic_namespace'
291: options.classic_namespace = true
292: }
293: ],
294: ['--describe', '-D [PATTERN]', "Describe the tasks (matching optional PATTERN), then exit.",
295: lambda { |value|
296: options.show_tasks = :describe
297: options.show_task_pattern = Regexp.new(value || '')
298: TaskManager.record_task_metadata = true
299: }
300: ],
301: ['--dry-run', '-n', "Do a dry run without executing actions.",
302: lambda { |value|
303: Rake.verbose(true)
304: Rake.nowrite(true)
305: options.dryrun = true
306: options.trace = true
307: }
308: ],
309: ['--execute', '-e CODE', "Execute some Ruby code and exit.",
310: lambda { |value|
311: eval(value)
312: exit
313: }
314: ],
315: ['--execute-print', '-p CODE', "Execute some Ruby code, print the result, then exit.",
316: lambda { |value|
317: puts eval(value)
318: exit
319: }
320: ],
321: ['--execute-continue', '-E CODE',
322: "Execute some Ruby code, then continue with normal task processing.",
323: lambda { |value| eval(value) }
324: ],
325: ['--libdir', '-I LIBDIR', "Include LIBDIR in the search path for required modules.",
326: lambda { |value| $:.push(value) }
327: ],
328: ['--no-search', '--nosearch', '-N', "Do not search parent directories for the Rakefile.",
329: lambda { |value| options.nosearch = true }
330: ],
331: ['--prereqs', '-P', "Display the tasks and dependencies, then exit.",
332: lambda { |value| options.show_prereqs = true }
333: ],
334: ['--quiet', '-q', "Do not log messages to standard output.",
335: lambda { |value| Rake.verbose(false) }
336: ],
337: ['--rakefile', '-f [FILE]', "Use FILE as the rakefile.",
338: lambda { |value|
339: value ||= ''
340: @rakefiles.clear
341: @rakefiles << value
342: }
343: ],
344: ['--rakelibdir', '--rakelib', '-R RAKELIBDIR',
345: "Auto-import any .rake files in RAKELIBDIR. (default is 'rakelib')",
346: lambda { |value| options.rakelib = value.split(':') }
347: ],
348: ['--require', '-r MODULE', "Require MODULE before executing rakefile.",
349: lambda { |value|
350: begin
351: require value
352: rescue LoadError => ex
353: begin
354: rake_require value
355: rescue LoadError
356: raise ex
357: end
358: end
359: }
360: ],
361: ['--rules', "Trace the rules resolution.",
362: lambda { |value| options.trace_rules = true }
363: ],
364: ['--silent', '-s', "Like --quiet, but also suppresses the 'in directory' announcement.",
365: lambda { |value|
366: Rake.verbose(false)
367: options.silent = true
368: }
369: ],
370: ['--system', '-g',
371: "Using system wide (global) rakefiles (usually '~/.rake/*.rake').",
372: lambda { |value| options.load_system = true }
373: ],
374: ['--no-system', '--nosystem', '-G',
375: "Use standard project Rakefile search paths, ignore system wide rakefiles.",
376: lambda { |value| options.ignore_system = true }
377: ],
378: ['--tasks', '-T [PATTERN]', "Display the tasks (matching optional PATTERN) with descriptions, then exit.",
379: lambda { |value|
380: options.show_tasks = :tasks
381: options.show_task_pattern = Regexp.new(value || '')
382: Rake::TaskManager.record_task_metadata = true
383: }
384: ],
385: ['--trace', '-t', "Turn on invoke/execute tracing, enable full backtrace.",
386: lambda { |value|
387: options.trace = true
388: Rake.verbose(true)
389: }
390: ],
391: ['--verbose', '-v', "Log message to standard output.",
392: lambda { |value| Rake.verbose(true) }
393: ],
394: ['--version', '-V', "Display the program version.",
395: lambda { |value|
396: puts "rake, version #{RAKEVERSION}"
397: exit
398: }
399: ],
400: ['--where', '-W [PATTERN]', "Describe the tasks (matching optional PATTERN), then exit.",
401: lambda { |value|
402: options.show_tasks = :lines
403: options.show_task_pattern = Regexp.new(value || '')
404: Rake::TaskManager.record_task_metadata = true
405: }
406: ],
407: ['--no-deprecation-warnings', '-X', "Disable the deprecation warnings.",
408: lambda { |value|
409: options.ignore_deprecate = true
410: }
411: ],
412: ]
413: end