lib/bundler/dependencies/cli.rb in bundler-dependencies-0.5.1 vs lib/bundler/dependencies/cli.rb in bundler-dependencies-0.6.0

- old
+ new

@@ -9,32 +9,47 @@ class CLI < ::Thor def self.shared_options method_option :path, type: :string, desc: 'Path to Gemfile.lock to scan' method_option :without, type: :array, desc: 'Gems to ignore', aliases: ['-W'] method_option :without_rails, type: :boolean, default: false, desc: 'Ignore all Rails gems', aliases: ['-R'] + method_option :color, type: :boolean, default: true, desc: 'Colorize output' end default_task :count map '--version' => :version - desc 'count', 'Checks for gems that install too many dependencies' + desc 'version', 'Prints the bundler-dependencies version' + def version + puts "#{File.basename($PROGRAM_NAME)} #{VERSION}" + end + + desc 'count', 'Count the number of dependencies each gem in the bundle relies on, recursively' shared_options method_option :minimum, type: :numeric, desc: 'Report only gems with a minimum N dependencies', aliases: ['-m'], default: 0 - def count + def count(*args) + return help(:count) if args.first == 'help' + Count.new(options).output end - desc 'graph [GEM]', 'Outputs a dependency graph' + desc 'graph [GEM]', 'Output a graph of dependencies, for all gems in the bundle or a specific gem' shared_options def graph(gem = nil) + return help(:graph) if gem == 'help' + Graph.new(gem, options).output end - desc 'version', 'Prints the bundler-dependencies version' - def version - puts "#{File.basename($PROGRAM_NAME)} #{VERSION}" + desc 'find [GEM]', 'Output gems in the bundle that depend on GEM' + shared_options + method_option :quiet, type: :boolean, default: false, desc: 'Show only the number of gems and no other output', aliases: ['-q'] + + def find(gem = nil) + return help(:find) if gem.nil? || gem == 'help' + + Find.new(gem, options).output end end end end