# File lib/mspec/commands/mspec-tag.rb, line 18
18:   def options(argv=ARGV)
19:     options = MSpecOptions.new "mspec tag [options] (FILE|DIRECTORY|GLOB)+", 30, config
20: 
21:     options.doc " Ask yourself:"
22:     options.doc "  1. What specs to run?"
23:     options.doc "  2. How to modify the execution?"
24:     options.doc "  3. How to display the output?"
25:     options.doc "  4. What tag action to perform?"
26:     options.doc "  5. When to perform it?"
27: 
28:     options.doc "\n What specs to run"
29:     options.filters
30: 
31:     options.doc "\n How to modify the execution"
32:     options.configure { |f| load f }
33:     options.name
34:     options.pretend
35:     options.unguarded
36:     options.interrupt
37: 
38:     options.doc "\n How to display their output"
39:     options.formatters
40:     options.verbose
41: 
42:     options.doc "\n What action to perform and when to perform it"
43:     options.on("-N", "--add", "TAG",
44:        "Add TAG with format 'tag' or 'tag(comment)' (see -Q, -F, -L)") do |o|
45:       config[:tagger] = :add
46:       config[:tag] = "#{o}:"
47:     end
48:     options.on("-R", "--del", "TAG",
49:        "Delete TAG (see -Q, -F, -L)") do |o|
50:       config[:tagger] = :del
51:       config[:tag] = "#{o}:"
52:       config[:outcome] = :pass
53:     end
54:     options.on("-Q", "--pass", "Apply action to specs that pass (default for --del)") do
55:       config[:outcome] = :pass
56:     end
57:     options.on("-F", "--fail", "Apply action to specs that fail (default for --add)") do
58:       config[:outcome] = :fail
59:     end
60:     options.on("-L", "--all", "Apply action to all specs") do
61:       config[:outcome] = :all
62:     end
63:     options.on("--list", "TAG", "Display descriptions of any specs tagged with TAG") do |t|
64:       config[:tagger] = :list
65:       config[:ltags] << t
66:     end
67:     options.on("--list-all", "Display descriptions of any tagged specs") do
68:       config[:tagger] = :list_all
69:     end
70:     options.on("--purge", "Remove all tags not matching any specs") do
71:       config[:tagger] = :purge
72:     end
73: 
74:     options.doc "\n Help!"
75:     options.debug
76:     options.version MSpec::VERSION
77:     options.help
78: 
79:     options.doc "\n Custom options"
80:     custom_options options
81: 
82:     options.doc "\n How might this work in the real world?"
83:     options.doc "\n   1. To add the 'fails' tag to failing specs"
84:     options.doc "\n     $ mspec tag path/to/the_file_spec.rb"
85:     options.doc "\n   2. To remove the 'fails' tag from passing specs"
86:     options.doc "\n     $ mspec tag --del fails path/to/the_file_spec.rb"
87:     options.doc "\n   3. To display the descriptions for all specs tagged with 'fails'"
88:     options.doc "\n     $ mspec tag --list fails path/to/the/specs"
89:     options.doc ""
90: 
91:     patterns = options.parse argv
92:     if patterns.empty?
93:       puts options
94:       puts "No files specified."
95:       exit 1
96:     end
97:     @files = files patterns
98:   end