#!/usr/bin/env ruby require 'gli' begin # XXX: Remove this begin/rescue before distributing your app require 'veda' require 'QR' rescue LoadError STDERR.puts "In development, you need to use `bundle exec bin/veda` to run your app" STDERR.puts "At install-time, RubyGems will make sure lib, etc. are in the load path" STDERR.puts "Feel free to remove this message from bin/veda now" exit 64 end include GLI::App # inclu command :generate do |c| c.desc 'Generate' c.switch :qr c.action do |global_options,options,args| if options[:qr] puts 'generate qr' path = args.first # raise 'cant help at this time' raise 'File name not given' if path.nil? raise "#{path}. File does not exist." unless File.file?(path) generate_qr path end end end on_error do |exception| # puts 'error occured' true end def generate_qr path qr = QR::Qr.new qr.generate_qr path end exit run(ARGV)