Sha256: 10b7e7c56dc06ecb7dbceefae12718d98bc10714565c1636d7b65a2ed6a5dd96

Contents?: true

Size: 1.06 KB

Versions: 65

Compression:

Stored size: 1.06 KB

Contents

require 'bibliothecary/version'
require 'bibliothecary'
require 'commander'

module Bibliothecary
  class CLI
    include Commander::Methods

    def run
      program :name, 'Bibliothecary'
      program :version, Bibliothecary::VERSION
      program :description, 'Parse dependency information from a file or folder of code'

      command(:list) do |c|
        c.syntax = 'bibliothecary list'
        c.description = 'List dependencies'
        c.option("--path FILENAME", String, "Path to file/folder to analyse")
        c.action do |_args, options|
          options.default path: './'
          output = Bibliothecary.analyse(options.path)
          output.each do |manifest|
            puts "#{manifest[:path]} (#{manifest[:platform]})"
            manifest[:dependencies].group_by{|d| d[:type] }.each do |type, deps|
              puts "  #{type}"
              deps.each do |dep|
                puts "    #{dep[:name]} #{dep[:requirement]}"
              end
              puts
            end
            puts
          end
        end
      end

      run!
    end
  end
end

Version data entries

65 entries across 65 versions & 1 rubygems

Version Path
bibliothecary-6.12.1 lib/bibliothecary/cli.rb
bibliothecary-6.12.0 lib/bibliothecary/cli.rb
bibliothecary-6.11.0 lib/bibliothecary/cli.rb
bibliothecary-6.10.7 lib/bibliothecary/cli.rb
bibliothecary-6.10.6 lib/bibliothecary/cli.rb
bibliothecary-6.10.5 lib/bibliothecary/cli.rb
bibliothecary-6.10.4 lib/bibliothecary/cli.rb
bibliothecary-6.10.3 lib/bibliothecary/cli.rb
bibliothecary-6.10.2 lib/bibliothecary/cli.rb
bibliothecary-6.10.1 lib/bibliothecary/cli.rb
bibliothecary-6.9.8 lib/bibliothecary/cli.rb
bibliothecary-6.9.7 lib/bibliothecary/cli.rb
bibliothecary-6.9.6 lib/bibliothecary/cli.rb
bibliothecary-6.9.5 lib/bibliothecary/cli.rb
bibliothecary-6.9.4 lib/bibliothecary/cli.rb
bibliothecary-6.9.3 lib/bibliothecary/cli.rb
bibliothecary-6.9.2 lib/bibliothecary/cli.rb
bibliothecary-6.9.1 lib/bibliothecary/cli.rb
bibliothecary-6.9.0 lib/bibliothecary/cli.rb
bibliothecary-6.8.10 lib/bibliothecary/cli.rb