Class: Shh::EntriesMenu

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

Instance Method Summary collapse

Methods included from Command

#camelize, #load_command

Constructor Details

#initialize(io, repository) ⇒ EntriesMenu

Returns a new instance of EntriesMenu.



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

def initialize io, repository
  @io, @repository = io, repository
  @prompt_text = 'shh > '
  @commands = {
    'ls'   => load_command(:list_entries, @repository, @io),
    'cd'   => load_command(:open_entry, @repository, @io)
  }
  if @repository.vcs_supported?
    @commands['history'] = load_command(:show_history, @repository, @io)
    @commands['exhume'] = load_command(:exhume_entry, @repository, @io)
    @commands['diff'] = load_command(:diff_entry, @repository, @io)
    @commands['ci'] = load_command(:commit_changes, @repository, @io)
  end
end