lib/heirloom/cli/shared.rb in heirloom-0.3.1 vs lib/heirloom/cli/shared.rb in heirloom-0.4.0
- old
+ new
@@ -1,10 +1,10 @@
module Heirloom
module CLI
module Shared
- def self.valid_options?(args)
+ def valid_options?(args)
provided = args[:provided]
required = args[:required]
logger = args[:logger]
missing_opts = required.map do |opt|
@@ -19,9 +19,18 @@
missing_opts.compact!
missing_opts.each {|missing_opt| logger.error missing_opt}
missing_opts.empty?
+ end
+
+ def load_config(args)
+ opts = args[:opts]
+ logger = args[:logger]
+ config = Config.new :logger => logger
+ config.access_key = opts[:key] if opts[:key_given]
+ config.secret_key = opts[:secret] if opts[:secret_given]
+ config
end
end
end
end