lib/heirloom/cli/show.rb in heirloom-0.3.1 vs lib/heirloom/cli/show.rb in heirloom-0.4.0
- old
+ new
@@ -1,29 +1,36 @@
module Heirloom
module CLI
class Show
+ include Heirloom::CLI::Shared
+
def initialize
@opts = read_options
@logger = HeirloomLogger.new :log_level => @opts[:level]
- exit 1 unless CLI::Shared.valid_options? :provided => @opts,
- :required => [:name],
- :logger => @logger
+ @config = load_config :logger => @logger,
+ :opts => @opts
+
+ exit 1 unless valid_options? :provided => @opts,
+ :required => [:name],
+ :logger => @logger
+
id = @opts[:id] ? @opts[:id] : latest_id
@archive = Archive.new :name => @opts[:name],
- :logger => @logger,
+ :config => @config,
:id => id
end
def show
jj @archive.show
end
private
def latest_id
- @archive = Archive.new :name => @opts[:name]
+ @archive = Archive.new :name => @opts[:name],
+ :config => @config
@archive.list(1).first
end
def read_options
Trollop::options do
@@ -38,13 +45,15 @@
If -i is ommited, latest version is displayed.
EOS
opt :help, "Display Help"
+ opt :key, "AWS Access Key ID", :type => :string
opt :level, "Log level [debug|info|warn|error].", :type => :string,
:default => 'info'
opt :name, "Name of archive.", :type => :string
opt :id, "id of the archive to display.", :type => :string
+ opt :secret, "AWS Secret Access Key", :type => :string
end
end
end
end