Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Combine search and query in station prompt #2

Merged
merged 6 commits into from
Oct 22, 2019

Conversation

0sc
Copy link
Contributor

@0sc 0sc commented Oct 20, 2019

I worked on eliminating the extra hop of searching for stations first before querying for departure.

The change here is introduces a new flag, -station where a user inputs the name of the station they are interested, the library query for stations matching the name, prompts the user to select on from the list and uses the id of the selection to fetch the departure information.

Sample usage:
departures -station haupt
Screenshot 2019-10-20 at 13 39 57

Say the user selects S Potsdam Hauptbahnhof, then
Screenshot 2019-10-20 at 13 40 24

Maybe it can replace the current functionality but I don't where there's another desirable use case for the id

Copy link
Owner

@noxer noxer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the change, please see the code comments...
Thank you.

departures.go Outdated Show resolved Hide resolved
departures.go Outdated Show resolved Hide resolved
departures.go Outdated Show resolved Hide resolved
departures.go Show resolved Hide resolved
@noxer
Copy link
Owner

noxer commented Oct 21, 2019

Maybe it can replace the current functionality but I don't where there's another desirable use case for the id

The use case for using the ID is when the tool is used in a dashboard where the ID will never change and having one fewer REST call that may fail is desirable.

@noxer
Copy link
Owner

noxer commented Oct 21, 2019

There seems to be something wrong with the selection:

tim@ultra:/tmp/departures$ go run . -station="Adlershof"
? Choose a station: Marktplatz Adlershof
841 Gransee, Bhf 17:08
tim@ultra:/tmp/departures$ go run . -station="Adlershof"
? Choose a station: Seilershof, Hauptstr.
841 Gransee, Bhf 17:08
tim@ultra:/tmp/departures$ go run . -station="Adlershof"
? Choose a station: S Adlershof
841 Gransee, Bhf 17:08

It seems to select "Marktplatz Adlershof" even if I choose another entry...

departures.go Outdated Show resolved Hide resolved
@0sc 0sc requested a review from noxer October 22, 2019 06:20
Copy link
Owner

@noxer noxer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks.

@noxer noxer merged commit 4b44332 into noxer:master Oct 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants