Sha256: ec623004d33e6cd51d6e184325ec704657b8e8ce5c59800ac86009d8f7ba280b

Contents?: true

Size: 1.08 KB

Versions: 3

Compression:

Stored size: 1.08 KB

Contents

#!/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
  <<EOS
#$0 ver.#{Brand2csv::VERSION}
Usage:
  #{File.basename(__FILE__)} timespan
    Find all brands registered in switzerland during the given timespan.
    The following examples valid timespan periods:
      1.10.2005
      1.10.2005-31.10.2005
      1.10.2005, 5.10.2005-31.10.2005
    The results are stored in the file ausgabe.csv.
    The trademark name is either a real brand name or a link to an image.
EOS
end

parser = OptionParser.new
opts = {}
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])
rescue Interrupt
  puts "Unterbrochen. Breche mit Fehler ab"
  exit 1
end

puts "#{__FILE__} completed successfully" if $VERBOSE

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
brand2csv-0.1.8 bin/brand2csv
brand2csv-0.1.7 bin/brand2csv
brand2csv-0.1.6 bin/brand2csv