Skip to content

Add a force flag to download a file without any user input - #1244

Closed
legraina wants to merge 3 commits into
graphhopper:masterfrom
legraina:master
Closed

legraina wants to merge 3 commits into
graphhopper:masterfrom
legraina:master

Conversation

@legraina

Copy link
Copy Markdown
Contributor

I have added a -f flag in the graphhopper.sh script to be able to run it correctly in a docker. The goal is to remove any input of the user, especially when trying to download a new file.
We can now run ./graphhopper.sh -f import europe_germany_berlin.pbf without having:

File not found 'europe_germany_berlin.pbf'. Press ENTER to get it from: http://download.geofabrik.de/europe/germany/berlin-latest.osm.pbf
Press CTRL+C if you do not have enough disc space or you don't want to download several MB.

@karussell

Copy link
Copy Markdown
Member

Thanks!

I regret a bit that we have such a limiting (but very simple) command line format and the force flag would be useful but does not really fit into the current schema. Also we plan to use dropwizard via #1108 that will require yet another slightly different parameter format, so I would postpone this for a bit.

@legraina

Copy link
Copy Markdown
Contributor Author

Ok, so no need to try to fix the current script and be sure that all checks pass ? If you like to use something like that for the moment, I can make a version that is compatible with the previous versions and where you can add new flags. As you like.

@karussell

Copy link
Copy Markdown
Member

Hmmh, I'm a bit undecided here as I've not looked yet very deep in the dropwizard change and I do not want to waste anyones time :)

My initial thought was to use the same parameter style for the script like we use for direct java call but this is probably not possible nor standard with bash parameter style.

@karussell

karussell commented Dec 20, 2017 •

Copy link
Copy Markdown
Member

The best would be something in the style of the java program like

./graphhopper.sh  --action import --datareader.file some.pbf

But maybe having this as a start with just -f is already good. Hmmh, but "force" could mean anything, maybe we should make the parameter more descriptive at the beginning and introduce shorter names later?

@legraina

Copy link
Copy Markdown
Contributor Author

Yes, I can totally do that for the moment (it would be pretty easy). I would also keep the previous settings to remain backwards compatible.

@legraina

Copy link
Copy Markdown
Contributor Author

I've added all these flags and also kept the positional arguments:
-h|--help
-f|--force-download
-a|--action
-d|--datareader.file
Does it seem good for you ?

@karussell

Copy link
Copy Markdown
Member

Does not look too bad :) thanks!

-f|--force-download

can we do -fd here and for datareader.file the -f?

@karussell

Copy link
Copy Markdown
Member

(Shouldn't sound negative regarding your work, sorry. Just still a bit hesitating to introduce yet another parameter format ...)

@karussell

karussell commented Dec 20, 2017 •

Copy link
Copy Markdown
Member

But maybe we can also iterate here after we've merged the dropwizardifying

@legraina

Copy link
Copy Markdown
Contributor Author

I've done the modifications. And no worry if you don't want :) I was doing these modifications to be able to use more easily the docker image (you can like that download and import any pbf file directly from the docker image, otherwise it's more tricky).

@karussell

Copy link
Copy Markdown
Member

Thanks again! (Give me a few days over the holidays and I can better judge :))

@karussell

Copy link
Copy Markdown
Member

I'm currently playing with fish and there is an interesting auto complete feature where the parameters and its description are shown. This would be cool to support - do you know if this is easy :) ?

@legraina

legraina commented Jan 2, 2018

Copy link
Copy Markdown
Contributor Author

From what I've seen, you cannot do that. To be able to have a nice completion in bash you need to load first the possible completion (https://debian-administration.org/article/317/An_introduction_to_bash_completion_part_2), and then you have access to an auto-completion. It means that you will have to 'install' graphhopper.

@karussell

Copy link
Copy Markdown
Member

As we change the command line handling due to #1314 we have to rewrite the script a bit. The work you did here seems really useful and I'll try to see how we can use it to make a cleaner scripting possible.

@karussell

Copy link
Copy Markdown
Member

Please have a look at #1319. Will close here for now.

@karussell karussell closed this Mar 23, 2018
@karussell karussell mentioned this pull request Mar 23, 2018
9 tasks done
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.

2 participants