lib/heirloom/cli/update.rb in heirloom-0.2.0 vs lib/heirloom/cli/update.rb in heirloom-0.3.0.rc1

- old
+ new

@@ -1,20 +1,25 @@ -module Heirloom +module Heirloom module CLI class Update def initialize @opts = read_options @logger = HeirloomLogger.new :log_level => @opts[:level] + exit 1 unless CLI::Shared.valid_options? :provided => @opts, + :required => [:name, :id, + :attribute, + :updated_value], + :logger => @logger @archive = Archive.new :name => @opts[:name], :id => @opts[:id], :logger => @logger end def update - @archive.update :attribute => @opts[:attribute], - :value => @opts[:value] + @archive.update :attribute => @opts[:attribute], + :value => @opts[:updated_value] end private def read_options @@ -24,19 +29,19 @@ Update an archive's attribute. Usage: -heirloom update -n NAME -i ID -a ATTRIBUTE_TO_UPDATE -v NEW_VALUE +heirloom update -n NAME -i ID -a ATTRIBUTE_TO_UPDATE -u UPDATED_VALUE EOS opt :attribute, "Attribute to update.", :type => :string opt :help, "Display Help" opt :id, "ID of the archive to display.", :type => :string - 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 :value, "New value of attribute.", :type => :string + opt :updated_value, "Updated value of attribute.", :type => :string end end end end end