Sha256: e168fe37cff1175a252b21abe7d8e52dd70ef07d125fe57c743ae037e8f701d4

Contents?: true

Size: 627 Bytes

Versions: 1

Compression:

Stored size: 627 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)
      AddCommand.new(storage).run([name, secret])
    end

    desc "show NAME", "shows the secret for the given key"
    def show(name)
      ShowCommand.new(storage).run([name])
    end

    desc "totp NAME", "generate a Time based One Time Password"
    def totp(name)
      TotpCommand.new(storage).run([name])
    end

    private

    def storage
      @storage ||= Storage.new(filename: options[:filename] || 'tfa')
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tfa-0.0.7 lib/tfa/cli.rb