# File lib/mspec/commands/mspec.rb, line 22
22:   def options(argv=ARGV)
23:     config[:command] = argv.shift if ["ci", "run", "tag"].include?(argv[0])
24: 
25:     options = MSpecOptions.new "mspec [COMMAND] [options] (FILE|DIRECTORY|GLOB)+", 30, config
26: 
27:     options.doc " The mspec command sets up and invokes the sub-commands"
28:     options.doc " (see below) to enable, for instance, running the specs"
29:     options.doc " with different implementations like ruby, jruby, rbx, etc.\n"
30: 
31:     options.configure do |f|
32:       load f
33:       config[:options] << '-B' << f
34:     end
35: 
36:     options.targets
37: 
38:     options.on("-D", "--gdb", "Run under gdb") do
39:       config[:use_gdb] = true
40:     end
41:     options.on("-A", "--valgrind", "Run under valgrind") do
42:       config[:flags] << '--valgrind'
43:     end
44:     options.on("--warnings", "Don't supress warnings") do
45:       config[:flags] << '-w'
46:       ENV['OUTPUT_WARNINGS'] = '1'
47:     end
48:     options.on("-j", "--multi", "Run multiple (possibly parallel) subprocesses") do
49:       config[:multi] = true
50:       config[:options] << "-fy"
51:     end
52:     options.version MSpec::VERSION do
53:       if config[:command]
54:         config[:options] << "-v"
55:       else
56:         puts "#{File.basename $0} #{MSpec::VERSION}"
57:         exit
58:       end
59:     end
60:     options.help do
61:       if config[:command]
62:         config[:options] << "-h"
63:       else
64:         puts options
65:         exit 1
66:       end
67:     end
68: 
69:     options.doc "\n Custom options"
70:     custom_options options
71: 
72:     # The rest of the help output
73:     options.doc "\n where COMMAND is one of:\n"
74:     options.doc "   run - Run the specified specs (default)"
75:     options.doc "   ci  - Run the known good specs"
76:     options.doc "   tag - Add or remove tags\n"
77:     options.doc " mspec COMMAND -h for more options\n"
78: 
79:     options.on_extra { |o| config[:options] << o }
80:     config[:options].concat options.parse(argv)
81:   end