Sha256: 92b6afdc62de4573e954e6c564fc8bd75e24b702b4c677281ba3ce612bff2c7b

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 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|
          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

1 entries across 1 versions & 1 rubygems

Version Path
bibliothecary-5.6.0 lib/bibliothecary/cli.rb