Class: Shh::EntryMenu

Inherits:
Object
  • Object
show all
Includes:
ShellShock::Context, Command
Defined in:
lib/shh/entry_menu.rb

Instance Method Summary collapse

Methods included from Command

#camelize, #load_command

Constructor Details

#initialize(io, entry) ⇒ EntryMenu

Returns a new instance of EntryMenu.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/shh/entry_menu.rb', line 8

def initialize io, entry
  @io, @entry = io, entry
  show_command = load_command(:show_key, entry, io)
  edit_command = load_command(:edit_key, entry, io)
  @commands = {
    'ls'     => load_command(:list_keys, entry, io),
    'set'    => load_command(:set_key, entry, io),
    'edit'   => edit_command,
    'cat'    => show_command,
    'less'   => show_command,
    'more'   => show_command,
    'cp'     => load_command(:copy_key, entry, io),
    'launch' => load_command(:launch_key, entry, io),
    'rm'     => load_command(:remove_key, entry, io),
    'exec'   => load_command(:execute_key, entry, io)
  }
end

Instance Method Details

#refresh_commandsObject



26
27
28
# File 'lib/shh/entry_menu.rb', line 26

def refresh_commands
  @prompt_text = "shh:#{@entry['name']} > "
end