lib/thor.rb in atli-0.1.12 vs lib/thor.rb in atli-0.1.13
- old
+ new
@@ -826,28 +826,10 @@
end
singleton_class.send :alias_method, :subtask_help, :subcommand_help
-
- # Atli Protected Class Methods
- # ======================================================================
-
- # Build a Thor::SharedOption and add it to Thor.shared_method_options.
- #
- # The Thor::SharedOption is returned.
- #
- # ==== Parameters
- # name<Symbol>:: The name of the argument.
- # options<Hash>:: Described in both class_option and method_option,
- # with the additional `:groups` shared option keyword.
- def self.build_shared_option(name, options)
- shared_method_options[name] = Thor::SharedOption.new(
- name,
- options.merge(:check_default_type => check_default_type?)
- )
- end # .build_shared_option
public # END protected Class Methods ***************************************
protected # Instance Methods
@@ -866,12 +848,19 @@
# Transform names into a set of strings
name_set = Set.new names.map( &:to_s )
# Add groups (if any)
if groups
- self.class.find_shared_options( groups: groups ).each do |name, option|
- name_set << name.to_s
- end
+ groups = Array( groups )
+
+ self.class.
+ shared_defs.
+ select { |shared_def|
+ groups.any? { |group| shared_def[ :groups].include? group }
+ }.
+ each do |shared|
+ name_set << shared[:name].to_s
+ end
end
options.slice( *name_set ).sym_keys
end