4teamwork / ftw.aare

A Shell Command which displays the current temperature of the Aare in Bern, Switzerland
MIT License
0 stars 0 forks source link

Tab autocompletion feature #18

Open Nachtalb opened 6 years ago

Nachtalb commented 6 years ago

image

I do not know if it is possible to create some sort of install script or so with pipsi. My Idea would be to create a autocompletion file for the common shells like fish, zsh, bash etc.

For fish it would be something like this:

complete -c aare -f
complete -c aare -l help -d 'Show usage'
complete -c aare -l statistics -d 'Show min & max temperature of the last 7 days' 

More information to fish can be found here: https://fishshell.com/docs/current/index.html#completion

Another option would be to use python itself and integrate it to ftw.aare directly. I don't know how this works though 😬 Maybe this helps: https://stackoverflow.com/questions/187621/how-to-make-a-python-command-line-program-autocomplete-arbitrary-things-not-int

Nachtalb commented 6 years ago

Just saw that you use click, and click has built-in bash autocomplete support 😬 http://click.pocoo.org/6/bashcomplete/ so there is that. But I use fish so yeah this doesn't help me 😆