From c9c7d389c45815e1b7abd7bea7dc5093a3630ea2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20P=C3=A9rez-Cerezo?= Date: Tue, 10 Oct 2017 11:45:50 +0200 Subject: Moved stuff to a module folder, preparing for setuptools --- bin/mensa | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100755 bin/mensa (limited to 'bin') diff --git a/bin/mensa b/bin/mensa new file mode 100755 index 0000000..b141990 --- /dev/null +++ b/bin/mensa @@ -0,0 +1,33 @@ +#!/usr/bin/python3 +import argparse +from mensa import logic +from mensa import base + +parser = argparse.ArgumentParser(description='Fetch menus from various sources') +# parser.add_argument('integers', metavar='N', type=int, nargs='+', +# help='an integer for the accumulator') +parser.add_argument('-r', '--restaurants', dest='rest', action='store', + metavar='LIST', + help='Comma-separated list of restaurants to fetch the menus from.') +parser.add_argument('-l', '--list-restaurants', dest='list', action='store_true', + help='get list of restaurants') + + +args = parser.parse_args() +## Load backends +logic.init_foodsources() +## Load frontends (not yet implemented) +logic.init_renderers() + + + +if args.list : + for k,i in base.foodsources.items(): + print(i.name, i.human_name) + exit() +restlist = None +if args.rest : + restlist = args.rest.split(",") + +foodl = logic.get_food(restlist) +logic.render(foodl, ["plain-text"]) -- cgit v1.2.3