lib/heirloom/cli/show.rb in heirloom-0.2.0 vs lib/heirloom/cli/show.rb in heirloom-0.3.0.rc1
- old
+ new
@@ -2,19 +2,22 @@
module CLI
class Show
def initialize
@opts = read_options
- id = @opts[:id] ? @opts[:id] : latest_id
@logger = HeirloomLogger.new :log_level => @opts[:level]
+ exit 1 unless CLI::Shared.valid_options? :provided => @opts,
+ :required => [:name],
+ :logger => @logger
+ id = @opts[:id] ? @opts[:id] : latest_id
@archive = Archive.new :name => @opts[:name],
- :id => id,
- :logger => @logger
+ :logger => @logger,
+ :id => id
end
def show
- puts @archive.show.to_yaml
+ jj @archive.show
end
private
def latest_id
@@ -35,13 +38,13 @@
If -i is ommited, latest version is displayed.
EOS
opt :help, "Display Help"
- opt :level, "Log level.", :type => :string,
- :default => 'info'
+ 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 :id, "id of the archive to display.", :type => :string
end
end
end
end