Last active
March 10, 2020 04:35
-
-
Save HansRobo/38060a841ca6be71181ccc9dcc62c86e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!bash | |
_chdistro() { | |
local cur prev cword opts | |
_get_comp_words_by_ref -n : cur prev cword | |
case "$3" in | |
chdistro) | |
COMPREPLY=( $(compgen -W "$(ls /opt/ros/)" -- "${cur}") );; | |
*) | |
COMPREPLY=( $(compgen -W "$(ls -F $HOME | grep /| sed -E "s@^@~/@g")" -- "${cur}") );; | |
esac | |
} | |
complete -o nospace -F _chdistro chdistro |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment