Sha256: f86c2ae06ee6a394d6dc9fbae42b484e2312f7c058f3181bb8127acf770db358

Contents?: true

Size: 883 Bytes

Versions: 5

Compression:

Stored size: 883 Bytes

Contents

#!/usr/bin/env ruby
require 'rubygems'

# DONT COMMIT
$:.push File.expand_path(File.join(File.dirname(__FILE__),"../lib"))

require 'zxing'
include ZXing

require 'optparse'

options = { :ecc => :l }

OptionParser.new do |o|
  o.on('-i', '--input filename') do |r|
    options[:input] = r
  end
  o.on('-o', '--output filename') do |r|
    options[:output] = r
  end
  o.on('-h') do
    options[:ecc] = :h
  end
  o.on('-m') do
    options[:ecc] = :m
  end
  o.on('-q') do
    options[:ecc] = :q
  end
  o.on('-l') do
    options[:ecc] = :l
  end
end.parse!

input = nil
if options[:input]
  input = File.read(options[:input])
else
  input = ARGV[0]
end

code = QRCode::Encoder::QRCode.new
QRCode::Encoder::Encoder::encode input, options[:ecc], code

output = options[:output] || STDOUT

code.matrix.image.write output

if output == STDOUT
  if output.tty?
    output.puts
  end
end

Version data entries

5 entries across 5 versions & 3 rubygems

Version Path
zxing_cpp_mac_big_sur-0.1.1 bin/zxe
zxing_cpp_no_cmake-0.1.2 bin/zxe
zxing_cpp_no_cmake-0.1.1 bin/zxe
zxing_cpp-0.1.1 bin/zxe
zxing_cpp-0.1.0 bin/zxe