lib/devinstall/cli.rb in devinstall-0.2.5 vs lib/devinstall/cli.rb in devinstall-0.2.6
- old
+ new
@@ -12,11 +12,11 @@
(@opt['config'] ||= (File.expand_path(f) if File.exist? f)) and break
end
@opt['config']
end
- def initialize
+ def initialize(package)
begin
@opt = Getopt::Long.getopts(
['--package', '-p', Getopt::REQUIRED],
['--config', '-c', Getopt::REQUIRED],
['--type', '-t', Getopt::REQUIRED],
@@ -40,9 +40,12 @@
# parse config file
Settings.load!(@opt['config'])
# complete from default values
%w"package env type".each { |o| @opt[o] ||= Settings.defaults[o.to_sym] if Settings.defaults[o.to_sym] }
# verify all informations
+ if package != '' # a packege was supplied on commandline
+ @opt['package'] = package # this overrides all
+ end
%w"package type env".each do |k|
unless @opt[k]
puts "You must specify option '#{k}' either as default or in command line"
help
end