From d6ed64f18cfccf1e6ffb5e5609f758beaec21def Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sat, 1 Dec 2018 02:34:04 +1300 Subject: Use simpler keyword complete for `path` subcommand --- bash/bash_completion.d/path.bash | 14 +++++++++++--- 1 file 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 -- cgit v1.2.3