Sha256: 7208b972648fe0ea07e9d351293d86056228a7fa23eec7a74e9de1fc43cce7b5

Contents?: true

Size: 865 Bytes

Versions: 2

Compression:

Stored size: 865 Bytes

Contents

#!/usr/bin/env ruby

require 'bundler/setup'
require 'optparse'
require 'ostruct'

require 'cryptorecord/openpgpkeys'

options = OpenStruct.new

OptionParser.new do |opt|
  opt.banner = "Usage: #{$PROGRAM_NAME} -u <email> -f <gpgkeyfile>"
  opt.on('-h', '--help', 'This help screen') do
    warn opt
    exit
  end
  opt.on('-f', '--publickeyfile PGP-PUBLICKEY-FILE',
         'PGP-Publickey-File') { |o| options.keyfile = o }
  opt.on('-u', '--uid EMAIL', 'email-address') { |o| options.uid = o }
  # this won't work with older ruby-versions
  options[:help] = opt.help
end.parse!

unless defined? options.keyfile
  warn 'Usage-Error: No keyfile provided'
  exit 1
end

unless defined? options.uid
  warn 'Usage-Error: No uid provided'
  exit 1
end

openpgpkeys = Cryptorecord::Openpgpkeys.new(options.to_h)
openpgpkeys.read_file(options.keyfile)
puts openpgpkeys

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cryptorecord-0.9.2 exe/openpgpkeysrecord
cryptorecord-0.9.1 exe/openpgpkeysrecord