Sha256: c855a7b218b5cb0d1a4095883b429fcf81049db110ad33883047333bbe93882a

Contents?: true

Size: 1.08 KB

Versions: 33

Compression:

Stored size: 1.08 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 |file_contents|
            puts "#{file_contents[:path]} (#{manifest[:platform]})"
            file_contents[: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

33 entries across 33 versions & 1 rubygems

Version Path
bibliothecary-8.6.3 lib/bibliothecary/cli.rb
bibliothecary-8.6.2 lib/bibliothecary/cli.rb
bibliothecary-8.6.1 lib/bibliothecary/cli.rb
bibliothecary-8.6.0 lib/bibliothecary/cli.rb
bibliothecary-8.5.1 lib/bibliothecary/cli.rb
bibliothecary-8.5.0 lib/bibliothecary/cli.rb
bibliothecary-8.4.6 lib/bibliothecary/cli.rb
bibliothecary-8.4.5 lib/bibliothecary/cli.rb
bibliothecary-8.4.4 lib/bibliothecary/cli.rb
bibliothecary-8.4.3 lib/bibliothecary/cli.rb
bibliothecary-8.4.2 lib/bibliothecary/cli.rb
bibliothecary-8.4.1 lib/bibliothecary/cli.rb
bibliothecary-8.4.0 lib/bibliothecary/cli.rb
bibliothecary-8.3.9 lib/bibliothecary/cli.rb
bibliothecary-8.3.8 lib/bibliothecary/cli.rb
bibliothecary-8.3.7 lib/bibliothecary/cli.rb
bibliothecary-8.3.6 lib/bibliothecary/cli.rb
bibliothecary-8.3.5 lib/bibliothecary/cli.rb
bibliothecary-8.3.4 lib/bibliothecary/cli.rb
bibliothecary-8.3.3 lib/bibliothecary/cli.rb