josevalim-thor 0.10.16 → 0.10.17
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/thor/base.rb +11 -5
- metadata +1 -1
data/lib/thor/base.rb
CHANGED
@@ -369,12 +369,16 @@ class Thor
|
|
369
369
|
|
370
370
|
protected
|
371
371
|
|
372
|
-
# Prints the class
|
373
|
-
#
|
374
|
-
#
|
375
|
-
#
|
372
|
+
# Prints the class options per group. If an option does not belong to
|
373
|
+
# any group, it uses the ungrouped name value. This method provide to
|
374
|
+
# hooks to add extra options, one of them if the third argument called
|
375
|
+
# extra_group that should be a Thor::CoreExt::OrderedHash in the format
|
376
|
+
# :group => Array[Options].
|
376
377
|
#
|
377
|
-
|
378
|
+
# The second is by returning a lamda used to print values. The lambda
|
379
|
+
# requires two options: the group name and the array of options.
|
380
|
+
#
|
381
|
+
def class_options_help(shell, ungrouped_name=nil, extra_group=nil) #:nodoc:
|
378
382
|
unless self.class_options.empty?
|
379
383
|
groups = self.class_options.group_values_by { |o| o.group }
|
380
384
|
|
@@ -404,7 +408,9 @@ class Thor
|
|
404
408
|
printer.call(ungrouped_name, global_options) if global_options
|
405
409
|
|
406
410
|
# Print all others
|
411
|
+
groups = extra_group.merge(groups) if extra_group
|
407
412
|
groups.each(&printer)
|
413
|
+
printer
|
408
414
|
end
|
409
415
|
end
|
410
416
|
|