Sha256: b462d6d7c174d342316a7c4a3e5f45b1a515bfa89f2fa00f75d07410dc702691

Contents?: true

Size: 589 Bytes

Versions: 1

Compression:

Stored size: 589 Bytes

Contents

module Shhh
  module App
    class Args < Struct.new(:opts, :argv)
      MODE = %i(encrypt decrypt generate edit keychain)
      KEY  = %i(private_key interactive keyfile keychain)
      OUTPUT = %i(output quiet)

      def mode?; is(MODE); end
      def key?; is(KEY); end

      def output_class
        output_type = OUTPUT.find{|o| opts[o] } # includes nil
        Shhh::App::Output.outputs[output_type]
      end

      private
      def is(list)
        !options_for(list).empty?
      end
      def options_for(of)
        of.map{ |o| opts[o] }.compact
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
shhh-1.5.4 lib/shhh/app/args.rb