Class: RubyDice::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/ruby-dice/cli.rb

Instance Method Summary collapse

Instance Method Details

#throwObject



12
13
14
15
16
17
18
19
20
21
22
23
# 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