1
0
Fork 0
mirror of https://github.com/nishiki/manage-password.git synced 2025-02-17 08:30:04 +00:00

add history in interactive mode

This commit is contained in:
adrien 2013-12-20 17:38:58 +01:00
parent 555695f477
commit a4d2f7f0cc

View file

@ -6,6 +6,7 @@
require 'rubygems' require 'rubygems'
require 'highline/import' require 'highline/import'
require 'pathname' require 'pathname'
require 'readline'
require "#{APP_ROOT}/lib/MPW.rb" require "#{APP_ROOT}/lib/MPW.rb"
@ -230,7 +231,8 @@ class Cli
group = nil group = nil
last_access = Time.now.to_i last_access = Time.now.to_i
while true while buf = Readline.readline("<mpw> ", true)
if @m.timeout_pwd < Time.now.to_i - last_access if @m.timeout_pwd < Time.now.to_i - last_access
passwd_confirm = ask("Password GPG: ") {|q| q.echo = false} passwd_confirm = ask("Password GPG: ") {|q| q.echo = false}
@ -244,7 +246,7 @@ class Cli
last_access = Time.now.to_i last_access = Time.now.to_i
end end
command = ask("<mpw> ").split(' ') command = buf.split(' ')
case command[0] case command[0]
when 'display', 'show', 'd', 's' when 'display', 'show', 'd', 's'
@ -291,6 +293,7 @@ class Cli
puts '# exit' puts '# exit'
puts '# q' puts '# q'
when 'quit', 'exit', 'q' when 'quit', 'exit', 'q'
puts 'Goodbye!'
break break
else else
if !command[0].nil? && !command[0].empty? if !command[0].nil? && !command[0].empty?