diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2018-12-07 01:01:49 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2018-12-07 01:01:49 +1300 |
commit | b54303b509d30e21679e0032e0875300c7b8b7dc (patch) | |
tree | e23d32e2d877f7c4dc4e2c32d82a7bb30ebc3e89 /bash/bash_completion.d/gpg.bash | |
parent | Remove unneeded stdout redirect (diff) | |
download | dotfiles-b54303b509d30e21679e0032e0875300c7b8b7dc.tar.gz dotfiles-b54303b509d30e21679e0032e0875300c7b8b7dc.zip |
Refactor some completions to avoid loops
Diffstat (limited to 'bash/bash_completion.d/gpg.bash')
-rw-r--r-- | bash/bash_completion.d/gpg.bash | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/bash/bash_completion.d/gpg.bash b/bash/bash_completion.d/gpg.bash index c6f92676..5a055352 100644 --- a/bash/bash_completion.d/gpg.bash +++ b/bash/bash_completion.d/gpg.bash @@ -13,14 +13,9 @@ _gpg() { # Generate completion reply from gpg(1) options local ci comp while read -r comp ; do - COMPREPLY[ci++]=$comp - done < <( - gpg --dump-options 2>/dev/null | - while read -r option ; do - case $option in - ("$2"*) printf '%s\n' "$option" ;; - esac - done - ) + case $comp in + "$2"*) COMPREPLY[ci++]=$comp ;; + esac + done < <(gpg --dump-options 2>/dev/null) } complete -F _gpg -o bashdefault -o default gpg |