lib/lapidarius/cli.rb in lapidarius-1.1.4 vs lib/lapidarius/cli.rb in lapidarius-2.0.1
- old
+ new
@@ -1,16 +1,16 @@
require "optparse"
-require "lapidarius/version"
require "lapidarius/cutter"
require "lapidarius/renderer"
module Lapidarius
class CLI
def initialize(args, io = STDOUT)
@args = args
@io = io
@gem = nil
+ @version = nil
@recursive = nil
end
def call(cmd_klass = Command)
parser.parse!(@args)
@@ -27,27 +27,26 @@
opts.on("-gGEM", "--gem=GEM", "The gem name to scan") do |gem|
@gem = gem
end
+ opts.on("-vVERSION", "--version=VERSION", "Specify the gem version") do |version|
+ @version = version
+ end
+
opts.on("-r", "--recursive", "Print dependencies recursively") do |recursive|
@recursive = recursive
end
- opts.on("-v", "--version", "Print library version") do
- @io.puts VERSION
- exit
- end
-
opts.on("-h", "--help", "Prints this help") do
@io.puts opts
exit
end
end
end
private def cutter(cmd_klass)
- @cutter = Lapidarius::Cutter.new(gem: @gem, cmd_klass: cmd_klass)
+ @cutter = Lapidarius::Cutter.new(gem: @gem, version: @version, cmd_klass: cmd_klass)
end
private def renderer(gem)
Lapidarius::Renderer::new(gem: gem, recursive: @recursive)
end