Sha256: f25828379f80d6df2f2efefea3ae5db53e5935900bf2be25e23de1e61817c9f6

Contents?: true

Size: 635 Bytes

Versions: 19

Compression:

Stored size: 635 Bytes

Contents

require 'guignol/commands/base'
require 'uuidtools'

Guignol::Shell.class_eval do
  desc 'uuid [COUNT]', 'Print random UUIDs'
  method_option :count,
    :aliases => %w(-c),
    :type => :numeric, :default => 1,
    :desc => 'Number of UUIDs to print'
  def uuid
    unless options[:count].kind_of?(Fixnum) && options[:count] > 0
      raise Thor::Error.new('Count should be a positive integer')
    end
    Guignol::Commands::UUID.new.run(options[:count])
  end
end


module Guignol::Commands
  class UUID
    def run(count = 1)
      count.times do
        puts UUIDTools::UUID.random_create.to_s.upcase
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
guignol-0.3.16 lib/guignol/commands/uuid.rb
guignol-0.3.15 lib/guignol/commands/uuid.rb
guignol-0.3.14 lib/guignol/commands/uuid.rb
guignol-0.3.13 lib/guignol/commands/uuid.rb
guignol-0.3.12 lib/guignol/commands/uuid.rb
guignol-0.3.10 lib/guignol/commands/uuid.rb
guignol-0.3.9 lib/guignol/commands/uuid.rb
guignol-0.3.8 lib/guignol/commands/uuid.rb
guignol-0.3.7 lib/guignol/commands/uuid.rb
guignol-0.3.6.2 lib/guignol/commands/uuid.rb
guignol-0.3.6.1 lib/guignol/commands/uuid.rb
guignol-0.3.6 lib/guignol/commands/uuid.rb
guignol-0.3.5.1 lib/guignol/commands/uuid.rb
guignol-0.3.5 lib/guignol/commands/uuid.rb
guignol-0.3.4 lib/guignol/commands/uuid.rb
guignol-0.3.3 lib/guignol/commands/uuid.rb
guignol-0.3.2 lib/guignol/commands/uuid.rb
guignol-0.3.1 lib/guignol/commands/uuid.rb
guignol-0.3.0 lib/guignol/commands/uuid.rb