-
Notifications
You must be signed in to change notification settings - Fork 5
How to enable Bash completion for goat v1 shortcuts?
Mateusz Piotrowski edited this page Apr 20, 2018
·
1 revision
This is an experimental feature - it will enable shortcut completion when you use goat
in Bash. It does not work for cd
.
Tested on macOS 10.12.1 running GNU bash, version 4.4.5(1)-release (x86_64-apple-darwin16.3.0).
-
Install
bash-completion
. -
Add this code to
~/.bash_completion
:_goat() { local cur prev opts local kGOAT_SHORTCUTS="$HOME/.goat/shortcuts.config" COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" opts="$(cut -f1 "$kGOAT_SHORTCUTS" | tr "\n" ' ')" if [[ ${cur} == * ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) return 0 fi } complete -F _goat goat
-
You might need to source
~/.bashrc
. -
Enjoy your completion for
goat
(goat <TAB>
should result in a list of your shortcuts).