Last active
October 28, 2024 20:26
-
-
Save meagar/1f98487788baac1e4085ae88baa4187b to your computer and use it in GitHub Desktop.
Tab completion for Thor and Rake in bash, handling colons
This file contains hidden or 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_profile | |
_thorcomplete() { | |
local cur | |
_get_comp_words_by_ref -n : cur | |
COMPREPLY=($(compgen -W "`bundle exec thor list | grep 'thor ' | cut -d " " -f 2`" -- $cur)) | |
__ltrim_colon_completions "$cur" | |
} | |
complete -o default -o nospace -F _thorcomplete thor | |
# For rake: | |
_rakecomplete() { | |
local cur | |
_get_comp_words_by_ref -n : cur | |
COMPREPLY=($(compgen -W "`bundle exec rake -T | cut -d " " -f 2`" -- $cur)) | |
__ltrim_colon_completions "$cur" | |
} | |
complete -o default -o nospace -F _rakecomplete rake | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment