josevalim-thor 0.10.16 → 0.10.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. data/lib/thor/base.rb +11 -5
  2. 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 optins per group. If a class options does not belong
373
- # to any group, it's grouped as "Class options" in Thor classes and as
374
- # "Options" in Thor::Group (since Thor::Group does not have method
375
- # options, there is not need to add "Class" frist).
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
- def class_options_help(shell, ungrouped_name=nil) #:nodoc:
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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: josevalim-thor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.16
4
+ version: 0.10.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yehuda Katz