@@ -121,6 +121,16 @@ def method_options(options = nil)
121
121
122
122
alias_method :options , :method_options
123
123
124
+
125
+ # Declares the class options which can be ignored for given command
126
+ #
127
+ # ==== Parameters
128
+ # list<Array>:: List of class options to be ignored
129
+ #
130
+ def ignore_class_options ( list = nil )
131
+ @class_options_to_ignore ||= list
132
+ end
133
+
124
134
# Adds an option to the set of method options. If :for is given as option,
125
135
# it allows you to change the options from a previous defined command.
126
136
#
@@ -172,7 +182,8 @@ def command_help(shell, command_name)
172
182
shell . say "Usage:"
173
183
shell . say " #{ banner ( command ) } "
174
184
shell . say
175
- class_options_help ( shell , nil => command . options . values )
185
+ class_options_help ( shell , command . ignored_options , nil => command . options . values )
186
+
176
187
if command . long_description
177
188
shell . say "Description:"
178
189
shell . print_wrapped ( command . long_description , :indent => 2 )
@@ -412,7 +423,7 @@ def create_command(meth) #:nodoc:
412
423
413
424
if @usage && @desc
414
425
base_class = @hide ? Thor ::HiddenCommand : Thor ::Command
415
- commands [ meth ] = base_class . new ( meth , @desc , @long_desc , @usage , method_options )
426
+ commands [ meth ] = base_class . new ( meth , @desc , @long_desc , @usage , method_options , ignore_class_options )
416
427
@usage , @desc , @long_desc , @method_options , @hide = nil
417
428
true
418
429
elsif all_commands [ meth ] || meth == "method_missing"
0 commit comments