updated short version of --next and fixed the help message
This commit is contained in:
parent
331d3bb608
commit
a07f58551d
@ -6,15 +6,6 @@ from datetime import datetime
|
||||
from crystal_orb import get_departures
|
||||
from crystal_orb import STOP_PLACES
|
||||
|
||||
"""
|
||||
Ideas:
|
||||
- If time is less than 15 min from now, time text turns red?
|
||||
- Maybe far-away departures are faint?
|
||||
- If realtime, then color green
|
||||
- Different
|
||||
|
||||
"""
|
||||
|
||||
def pad(s, total_length, justification="l"):
|
||||
if len(s) >= total_length:
|
||||
return s[0:total_length]
|
||||
@ -82,10 +73,23 @@ def print_help_info():
|
||||
print(
|
||||
"""Help info for the crystal orb cli.
|
||||
Possible commands:
|
||||
<stop place> : query the api for all busses from the given stop place
|
||||
-h or --help : Show this screen
|
||||
--list-stop-places : List the admissible stop places,
|
||||
This is configured in the STOP_PLACES dict in crystal_orb.py""")
|
||||
<stop place>
|
||||
query the api for all busses from the given stop place
|
||||
-h or --help
|
||||
Show this screen
|
||||
-l or --list-stop-places
|
||||
List the admissible stop places.
|
||||
This is configured in the STOP_PLACES dict in crystal_orb.py
|
||||
-n or --next
|
||||
Limit the response to only the next bus matching the query
|
||||
-b <line> or --bus <line>
|
||||
Limit the response to only the supplied bus line
|
||||
-s <place> or --stop <place>
|
||||
Change the stop place to the supplied place
|
||||
-t or --to
|
||||
Limit the response to buses going into town
|
||||
-f or --from
|
||||
Limit the response to buses going away from town""")
|
||||
|
||||
if __name__ == "__main__":
|
||||
args = sys.argv
|
||||
@ -108,7 +112,7 @@ if __name__ == "__main__":
|
||||
for i, arg in enumerate(args):
|
||||
if i == 1 and arg[0] != "-": # First argument is taken as the stop place
|
||||
stop_place = arg.lower()
|
||||
elif arg == "--next": # Limits to only giving "the next bus" matching the query
|
||||
elif arg == "-n" or arg == "--next": # Limits to only giving "the next bus" matching the query
|
||||
take_one = True
|
||||
elif arg == "-b" or arg == "--bus": # Limit to specific bus line
|
||||
try:
|
||||
|
Loading…
Reference in New Issue
Block a user