Sha256: 375a121050e2f92f272d593c03a900e57e0109bfc5a1785a3185f2d06d34f8d9

Contents?: true

Size: 921 Bytes

Versions: 2

Compression:

Stored size: 921 Bytes

Contents

#!/usr/bin/env ruby

require "optparse"
require "macserialrb"
require "securerandom"

options = {}

op = OptionParser.new do |parser|
  parser.banner = "Usage: macserialrb [options]"
  parser.on("-v", "--version", "macserialrb version") do |v|
    options[:version] = v
  end

  parser.on("-l", "--list", "list all mac models") do |v|
    options[:list] = v
  end

  parser.on("-m", "--model [iMac19,1]", String, "mac model") do |v|
    options[:model] = v
  end
end

if ARGV.length == 0
  op.parse! %w[--help]
  exit 0
else
  op.parse!
end

if options[:version]
  puts ["Macserialrb", Macserialrb::VERSION].join " "
  exit 0
end

if options[:list]
  puts Macserialrb.models
  exit 0
end

info = Macserialrb.generate options.slice(:model)

info[:SystemUUID] = SecureRandom.uuid.upcase
info[:ROM] = SecureRandom.hex(6).upcase

puts "#{options[:model]} macserial info \n\n"
info.each do |k, v|
  puts [k, v].join(": ")
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
macserialrb-0.4.0 exe/macserialrb
macserialrb-0.3.0 exe/macserialrb