Class: RPass::ShellCommand

Inherits:
Clamp::Command
  • Object
show all
Defined in:
lib/rpass/shell_command.rb

Instance Method Summary collapse

Instance Method Details

#all_accountsObject



19
20
21
# File 'lib/rpass/shell_command.rb', line 19

def all_accounts
  RPass.vault.accounts
end

#executeObject



8
9
10
11
12
13
14
15
16
17
# File 'lib/rpass/shell_command.rb', line 8

def execute
  io = HighLine.new
  shell = Shell.new(all_accounts)
  console = ::CLI::Console.new(io)
  console.addCommand("ls", shell.method(:ls), "List lastpass entries.")
  console.addCommand("print", shell.method(:print), "Print password for the specified entry, by number.")
  console.addCommand("cp", shell.method(:cp), "Copy password for the specified entry to clipboard.")
  console.addExitCommand('quit', 'Quit')
  console.start("%s> ", [shell.method(:prompt)])
end