class RubyDice::CLI

Public Instance Methods

throw() click to toggle source
# File lib/ruby-dice/cli.rb, line 12
def throw
  passphrase_options = {}.tap do |o|
    o[:words] = options['length']
    o[:wordlist] = options['wordlist']
    o[:camelcase] = options['camelcase']
    o[:numbers] = options['numbers']
  end

  passphrase = RubyDice::Passphrase.generate passphrase_options
  IO.popen('xsel --clipboard --input', 'r+') { |c| c.print passphrase }
  puts passphrase if options['print']
end