def main(): parser = argparse.ArgumentParser( description="Web server module for the µoogle project", epilog=moogle.authors(), ) parser.add_argument("-p", "--port", type=int, help="port where to listen", default=5000) parser.add_argument("-d", "--database", type=str, help="filename of the database", default="moogle.dat") args = parser.parse_args(sys.argv[1:]) try: app.db = moogle.load(args.database) except Exception as e: print(e) app.run()
def main(): parser = argparse.ArgumentParser( description="Answer module for the µoogle project", epilog=moogle.authors(), ) parser.add_argument("-q", "--query", type=str, help="query (use single quotes for more than one word") parser.add_argument("-d", "--database", type=str, help="filename of the database", default="moogle.dat") args = parser.parse_args(sys.argv[1:]) db = moogle.load(args.database) answer = moogle.answer(db, args.query) pprint.pprint(answer)