diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2018-12-01 02:34:04 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2018-12-01 02:34:04 +1300 |
commit | d6ed64f18cfccf1e6ffb5e5609f758beaec21def (patch) | |
tree | 8931acb9d06d1d03bd38691a329bd36b729d84a6 | |
parent | Break up a couple of long lines (diff) | |
download | dotfiles-d6ed64f18cfccf1e6ffb5e5609f758beaec21def.tar.gz dotfiles-d6ed64f18cfccf1e6ffb5e5609f758beaec21def.zip |
Use simpler keyword complete for `path` subcommand
-rw-r--r-- | bash/bash_completion.d/path.bash | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/bash/bash_completion.d/path.bash b/bash/bash_completion.d/path.bash index ce494bd4..7143b448 100644 --- a/bash/bash_completion.d/path.bash +++ b/bash/bash_completion.d/path.bash @@ -6,10 +6,18 @@ _path() { # Complete operation as first word local cmd - for cmd in list insert append remove shift pop check help ; do - [[ $cmd == "${COMP_WORDS[COMP_CWORD]}"* ]] || continue + while read -r cmd ; do COMPREPLY[${#COMPREPLY[@]}]=$cmd - done + done < <(compgen -W ' + append + check + help + insert + list + pop + remove + shift + ' -- "${COMP_WORDS[COMP_CWORD]}") # Complete with either directories or $PATH entries as all other words else |