Class: Keystorage::Command::Get

Inherits:
Base
  • Object
show all
Defined in:
lib/keystorage/command/get.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#initialize, run

Constructor Details

This class inherits a constructor from Keystorage::Command::Base

Class Method Details

.helpObject



18
19
20
21
22
23
24
25
# File 'lib/keystorage/command/get.rb', line 18

def help
  "Description:
    get key from file

Usage:
    keystrage [options] get groups [name]
"
end

Instance Method Details

#execute(argv) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/keystorage/command/get.rb', line 6

def execute(argv)
  group = argv.shift
  raise "missing parameter"  unless group
  
  name = argv.shift
  ks = Manager.new(@file)
  data = ks.get(group,name)
  raise "missing %s " % [group] unless data
  puts data
end