aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2018-12-01 02:34:04 +1300
committerTom Ryder <tom@sanctum.geek.nz>2018-12-01 02:34:04 +1300
commitd6ed64f18cfccf1e6ffb5e5609f758beaec21def (patch)
tree8931acb9d06d1d03bd38691a329bd36b729d84a6
parent18d31e8c13cf8ae97a16bfcf949dbae5391a47f2 (diff)
downloaddotfiles-d6ed64f18cfccf1e6ffb5e5609f758beaec21def.tar.gz
Use simpler keyword complete for `path` subcommand
-rw-r--r--bash/bash_completion.d/path.bash14
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