Class: Shh::Command::EditKey

Inherits:
Object
  • Object
show all
Includes:
KeyCommand
Defined in:
lib/shh/command/edit_key.rb

Instance Method Summary collapse

Methods included from KeyCommand

#completion, #initialize, #usage

Instance Method Details

#execute(key = nil) ⇒ Object



11
12
13
14
# File 'lib/shh/command/edit_key.rb', line 11

def execute key=nil
  new_value = (@entry[key] || '').to_editor
  @entry[key] = new_value if new_value.length > 0
end

#helpObject



7
8
9
# File 'lib/shh/command/edit_key.rb', line 7

def help
  "Launches an external editor (specified by EDITOR environment variable) to edit the value associated with the specified key"
end