diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2018-12-01 02:29:42 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2018-12-01 02:29:42 +1300 |
commit | 0681de59778f82c9006de70ed9a9ee6644fd4a18 (patch) | |
tree | 1bba07ac51710494c17920f553dea26a69df55d0 /bash/bash_completion.d/gpg.bash | |
parent | Remove unneeded quoting in case statement (diff) | |
download | dotfiles-0681de59778f82c9006de70ed9a9ee6644fd4a18.tar.gz dotfiles-0681de59778f82c9006de70ed9a9ee6644fd4a18.zip |
Adjust loop short circuits and pattern matches
Diffstat (limited to 'bash/bash_completion.d/gpg.bash')
-rw-r--r-- | bash/bash_completion.d/gpg.bash | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/bash/bash_completion.d/gpg.bash b/bash/bash_completion.d/gpg.bash index 2855a1a9..0f6785f9 100644 --- a/bash/bash_completion.d/gpg.bash +++ b/bash/bash_completion.d/gpg.bash @@ -5,13 +5,18 @@ _gpg() { hash gpg 2>/dev/null || return 1 # Bail if not completing an option - [[ ${COMP_WORDS[COMP_CWORD]} == --* ]] || return 1 + case ${COMP_WORDS[COMP_CWORD]} in + --*) return 1 ;; + esac # Generate completion reply from gpg(1) options local option while read -r option ; do - [[ $option == "${COMP_WORDS[COMP_CWORD]}"* ]] || continue - COMPREPLY[${#COMPREPLY[@]}]=$option + case $option in + "${COMP_WORDS[COMP_CWORD]}"*) + COMPREPLY[${#COMPREPLY[@]}]=$option + ;; + esac done < <(gpg --dump-options 2>/dev/null) } complete -F _gpg -o bashdefault -o default gpg |