lib/spandx/cli.rb in spandx-0.3.0 vs lib/spandx/cli.rb in spandx-0.4.0
- old
+ new
@@ -2,10 +2,11 @@
require 'thor'
require 'spandx'
require 'spandx/command'
+require 'spandx/commands/build'
require 'spandx/commands/scan'
module Spandx
class CLI < Thor
Error = Class.new(StandardError)
@@ -14,10 +15,24 @@
def version
puts "v#{Spandx::VERSION}"
end
map %w[--version -v] => :version
- desc 'scan LOCKFILE', 'Command description...'
+ desc 'build', 'Build a package index'
+ method_option :help, aliases: '-h', type: :boolean,
+ desc: 'Display usage information'
+ method_option :directory, aliases: '-d', type: :string,
+ desc: 'Directory to build index in'
+ def build(*)
+ if options[:help]
+ invoke :help, ['build']
+ else
+ require_relative 'commands/build'
+ Spandx::Commands::Build.new(options).execute
+ end
+ end
+
+ desc 'scan LOCKFILE', 'Scan a lockfile and list dependencies/licenses'
method_option :help, aliases: '-h', type: :boolean,
desc: 'Display usage information'
def scan(lockfile = nil)
if options[:help]
invoke :help, ['scan']