Sha256: 158ea33dd734da604b09e18e230de6c7eb3036b780e4dad1a1f159e3d05682c7

Contents?: true

Size: 864 Bytes

Versions: 2

Compression:

Stored size: 864 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::Openpgpkey.new(options.to_h)
openpgpkeys.read_file(options.keyfile)
puts openpgpkeys

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cryptorecord-1.0.0 exe/openpgpkeysrecord
cryptorecord-0.9.6 exe/openpgpkeysrecord