Sha256: ca2a7ea391d39ee279c9ab9bb91a3831b3f003789aee5a91e989cf608d9ffdd1
Contents?: true
Size: 653 Bytes
Versions: 2
Compression:
Stored size: 653 Bytes
Contents
require "thor" module TFA class CLI < Thor package_name "TFA" class_option :filename desc "add NAME SECRET", "add a new secret to the database" def add(name, secret) storage.save(name, secret) "Added #{name}" end desc "show NAME", "shows the secret for the given key" def show(name = nil) name ? storage.secret_for(name) : storage.all end desc "totp NAME", "generate a Time based One Time Password" def totp(name = nil) TotpCommand.new(storage).run([name]) end private def storage @storage ||= Storage.new(filename: options[:filename] || 'tfa') end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
tfa-0.0.10 | lib/tfa/cli.rb |
tfa-0.0.9 | lib/tfa/cli.rb |