Class: Totpc::CLI
- Inherits:
-
Thor
- Object
- Thor
- Totpc::CLI
- Defined in:
- lib/totpc/cli.rb
Overview
command line interpreter
Instance Method Summary collapse
- #add ⇒ Object
- #chpass ⇒ Object
-
#initialize(args, local_options, config) ⇒ CLI
constructor
A new instance of CLI.
- #list ⇒ Object
- #print ⇒ Object
- #remove ⇒ Object
Constructor Details
Instance Method Details
#add ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/totpc/cli.rb', line 16 def add STDOUT.print 'id: ' id = STDIN.gets.chomp STDOUT.print 'secret: ' secret = STDIN.gets.chomp @secrets.add(id: id, secret: secret) end |
#chpass ⇒ Object
35 36 37 |
# File 'lib/totpc/cli.rb', line 35 def chpass @secrets.chpass end |
#list ⇒ Object
31 32 33 |
# File 'lib/totpc/cli.rb', line 31 def list @secrets.list end |
#print ⇒ Object
12 13 14 |
# File 'lib/totpc/cli.rb', line 12 def print @secrets.print end |
#remove ⇒ Object
24 25 26 27 28 29 |
# File 'lib/totpc/cli.rb', line 24 def remove STDOUT.print 'id: ' id = STDIN.gets.chomp STDOUT.print 'remove ' + id + '? y/[n] ' @secrets.remove(id) if /^[yY]/ =~ STDIN.gets end |