Sha256: ab6be637198353773e4c70692ec69cde3f823ef607021e389d382ac19ec38fbb

Contents?: true

Size: 1.08 KB

Versions: 15

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]} (#{file_contents[: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

15 entries across 15 versions & 1 rubygems

Version Path
bibliothecary-12.0.0 lib/bibliothecary/cli.rb
bibliothecary-11.0.1 lib/bibliothecary/cli.rb
bibliothecary-11.0.0 lib/bibliothecary/cli.rb
bibliothecary-10.2.4 lib/bibliothecary/cli.rb
bibliothecary-10.2.3 lib/bibliothecary/cli.rb
bibliothecary-10.2.2 lib/bibliothecary/cli.rb
bibliothecary-10.2.0 lib/bibliothecary/cli.rb
bibliothecary-10.1.0 lib/bibliothecary/cli.rb
bibliothecary-10.0.0 lib/bibliothecary/cli.rb
bibliothecary-9.1.0 lib/bibliothecary/cli.rb
bibliothecary-9.0.0 lib/bibliothecary/cli.rb
bibliothecary-8.8.1 lib/bibliothecary/cli.rb
bibliothecary-8.7.7 lib/bibliothecary/cli.rb
bibliothecary-8.7.6 lib/bibliothecary/cli.rb
bibliothecary-8.7.5 lib/bibliothecary/cli.rb