+@outputDir = 'output'
+
+@config_file = 'quanlib.ini'
+@skip_class = false
+
+def handleArg(arg)
+ if arg.start_with?("--config=")
+ @config_file = arg[9..-1]
+ puts 'Using config file "' + @config_file + '".'
+ elsif "--purge" == arg
+ puts 'Purging database...'
+ @store.dropSchema()
+ if File.exists?(@store.unclassified_csv)
+ File.delete(@store.unclassified_csv)
+ end
+ elsif "--skip-class" == arg
+ puts 'Skipping load of classification table.'
+ @skip_class = true
+ elsif arg.start_with?("--")
+ abort('ERROR: Unrecognized option "' + arg + '".')
+ end
+end
+
+@store = Store.new(@config_file)
+@store.connect()
+
+for arg in ARGV
+ handleArg(arg)
+end
+
+@store.init_db(@skip_class)