#!/usr/bin/python from nilmdb import Interval from optparse import OptionParser import sys version = "1.0" parser = OptionParser() parser.add_option("-d", "--db", dest="database", metavar="DATABASE", help="location of sqlite database") parser.add_option("-V", "--version", dest="version", default=False, action="store_true", help="print version then exit") (options, args) = parser.parse_args() if (options.version): print "This script version: " + version sys.exit(0) if options.database is None: print "Error: database is mandatory" sys.exit(1) print "Database is " + options.database