diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2014-05-08 00:29:02 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2014-05-08 00:29:02 +1200 |
commit | 73f0ad4d2bfef5b324e3c2aa657710e6b6eb2cf4 (patch) | |
tree | 60d7b540c88cc614884da17c4f11695c8ddb66d5 /bash/bashrc.d | |
parent | Formalise license (diff) | |
download | dotfiles-73f0ad4d2bfef5b324e3c2aa657710e6b6eb2cf4.tar.gz dotfiles-73f0ad4d2bfef5b324e3c2aa657710e6b6eb2cf4.zip |
Use gpg options dump directly in completion
Parsing it into an array is slow and a waste of time
Diffstat (limited to 'bash/bashrc.d')
-rw-r--r-- | bash/bashrc.d/gnupg.bash | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/bash/bashrc.d/gnupg.bash b/bash/bashrc.d/gnupg.bash index ba67a327..e5962d21 100644 --- a/bash/bashrc.d/gnupg.bash +++ b/bash/bashrc.d/gnupg.bash @@ -25,15 +25,10 @@ _gpg() { return 1 fi - # Read options from the output of gpg --dump-options - local -a options - local option - while read -r option ; do - options=("${options[@]}" "$option") - done < <(gpg --dump-options 2>/dev/null) - # Generate completion reply - COMPREPLY=( $(compgen -W "${options[*]}" -- "$word") ) + COMPREPLY=( $(compgen -W \ + "$(gpg --dump-options 2>/dev/null)" \ + -- "$word") ) } complete -F _gpg -o default gpg |