#!/usr/bin/env ruby require 'pathname' root = Pathname.new(__FILE__).realpath.parent.parent $:.unshift root.join('lib') if $0 == __FILE__ require 'optparse' require 'brand2csv' def help <.csv. The trademark name is either a real brand name or a link to an image. --swiss_only Fetch only trademarks from swiss owner EOS end parser = OptionParser.new opts = {} parser.on('--swiss_only') {|v| opts[:swiss_only] = true } parser.on_tail('-h', '--help') { puts help; exit } args = ARGV.dup begin parser.parse!(args) rescue OptionParser::MissingArgument, OptionParser::InvalidArgument, OptionParser::InvalidOption puts help exit 1 end unless args.size >= 1 puts help exit 1 end begin Brand2csv::run(args[0], args[1], opts[:swiss_only]) rescue Interrupt puts "Unterbrochen. Breche mit Fehler ab" exit 1 end puts "#{__FILE__} completed successfully" if $VERBOSE