From 7355b3e3503ca95e1ee11ebb814c3f2551143a86 Mon Sep 17 00:00:00 2001 From: Gabriel Pérez-Cerezo Date: Thu, 1 Mar 2018 17:47:10 +0100 Subject: Bumped version to 0.3, added html formatter --- bin/mensa | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) (limited to 'bin') diff --git a/bin/mensa b/bin/mensa index 0fa4d81..0ccad0c 100755 --- a/bin/mensa +++ b/bin/mensa @@ -5,13 +5,16 @@ 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('rest', nargs="*", + metavar='RESTAURANT', + help='Fetch menus from this restaurant') parser.add_argument('-l', '--list-restaurants', dest='list', action='store_true', help='get list of restaurants') +parser.add_argument('-f', '--formatter', dest='form', action='store', nargs=1, help="formatter to use") +parser.add_argument('-g', '--vegetarian', dest='vegetarian', action='store_true', + help='show only vegetarian meals') +parser.add_argument('-G', '--vegan', dest='vegan', action='store_true', + help='show only vegan meals') args = parser.parse_args() @@ -19,6 +22,16 @@ args = parser.parse_args() logic.init_foodsources() ## Load frontends (not yet implemented) logic.init_renderers() +veggie = 0 +form = ["plain-text"] +if args.form : + form = args.form + + +if args.vegetarian : + veggie = 1 +if args.vegan : + veggie = 2 @@ -28,7 +41,7 @@ if args.list : exit() restlist = None if args.rest : - restlist = args.rest.split(",") + restlist = args.rest foodl = logic.get_food(restlist) -logic.render(foodl, ["plain-text"]) +logic.render(foodl, form, only_veggie=veggie) -- cgit v1.2.3