MarkusH / bvg-grabber

Querying the upcoming public transport departures in Berlin
BSD 3-Clause "New" or "Revised" License
28 stars 6 forks source link

Parameter position don't match help text #9

Open hechi opened 10 years ago

hechi commented 10 years ago

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?

hechi commented 10 years ago

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

MarkusH commented 10 years ago

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.