diff options
author | Gabriel Pérez-Cerezo <gabriel@gpcf.eu> | 2018-03-01 17:47:10 +0100 |
---|---|---|
committer | Gabriel Pérez-Cerezo <gabriel@gpcf.eu> | 2018-03-01 17:47:10 +0100 |
commit | 7355b3e3503ca95e1ee11ebb814c3f2551143a86 (patch) | |
tree | 510ae83289ef0f8bcef05fa52c6c7b5a8727bc35 /bin/mensa | |
parent | ff5121b7512f4677ddca1e922e4c66ca6b546694 (diff) | |
download | mensa-7355b3e3503ca95e1ee11ebb814c3f2551143a86.tar.gz mensa-7355b3e3503ca95e1ee11ebb814c3f2551143a86.tar.bz2 mensa-7355b3e3503ca95e1ee11ebb814c3f2551143a86.zip |
Bumped version to 0.3, added html formatter
Diffstat (limited to 'bin/mensa')
-rwxr-xr-x | bin/mensa | 27 |
1 files changed, 20 insertions, 7 deletions
@@ -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) |