MarkusH / bvg-grabber

Querying the upcoming public transport departures in Berlin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Parameter position don't match help text

hechi opened this issue · comments

if i use

$ bvg-grabber.py --limit 2 "U Ernst-Reuter-Platz (Berlin)" - --vehicle BUS | json_pp

everything works but if i try to use

$ bvg-grabber.py --limit 2 --vehicle BUS "U Ernst-Reuter-Platz (Berlin)" - | json_pp           
usage: bvg-grabber.py [-h]
                      [--vehicle [{S,U,TRAM,BUS,FERRY,RB,IC} [{S,U,TRAM,BUS,FERRY,RB,IC} ...]]]
                      [--limit LIMIT]
                      station file
bvg-grabber.py: error: argument --vehicle: invalid choice: 'U Ernst-Reuter-Platz (Berlin)' (choose from 'S', 'U', 'TRAM', 'BUS', 'FERRY', 'RB', 'IC')
malformed JSON string, neither array, object, number, string or atom, at character offset 0 (before "(end of string)") at /usr/bin/json_pp line 44.

it crash.
The help message also show taht we can use --vehicle in before station and file. Or did i get something wrong?

Ahh... i see my mistake i cant use --limit before --vehicle

No, it's actually a limitation in the python argparse library. --vehicle accepts 1 to n arguments, and everything after it that is not a flag (starts with -* or --) is considered a argument. I think I'll port the client to Click at some time.