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:
parent
555695f477
commit
a4d2f7f0cc
1 changed files with 5 additions and 2 deletions
|
@ -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?
|
||||||
|
|
Loading…
Add table
Reference in a new issue