Class: Pwl::Commands::Get
Instance Method Summary collapse
Methods inherited from Base
default_locker_file, exit_codes_help
Instance Method Details
#call(args, options) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/pwl/commands/get.rb', line 4 def call(args, ) exit_with(:name_blank, .verbose) if 0 == args.size || args[0].blank? # second argument can be a field other than password field = args.size > 1 ? args[1] : 'password' begin locker = open_locker() result = attr!(locker.get(args[0]), field) if result.blank? exit_with(:no_value_found, .verbose, :name => args[0]) else puts result end rescue InacessibleFieldError exit_with(:inaccessible_field, .verbose, :field => field) rescue Dialog::Cancelled exit_with(:aborted, .verbose) end end |