diff options
Diffstat (limited to 'bash/bash_completion.d/openssl.bash')
-rw-r--r-- | bash/bash_completion.d/openssl.bash | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/bash/bash_completion.d/openssl.bash b/bash/bash_completion.d/openssl.bash index 1cb4bd07..1e2a9c58 100644 --- a/bash/bash_completion.d/openssl.bash +++ b/bash/bash_completion.d/openssl.bash @@ -8,25 +8,18 @@ _openssl() { ((COMP_CWORD == 1)) || return # Iterate through completions produced by subshell - local ci comp - while read -r comp ; do - COMPREPLY[ci++]=$comp + local -a subcmds + local ci subcmd + while read -a subcmds -r ; do + for subcmd in "${subcmds[@]}" ; do + case $subcmd in + "$2"*) COMPREPLY[ci++]=$subcmd ;; + esac + done done < <( - - # Run each of the command-listing commands; read each line into an - # array of subcommands (they are printed as a table) - for list in commands digest-commands cipher-commands ; do - openssl list -"$list" - done | { - declare -a subcmds - while read -a subcmds -r ; do - for subcmd in "${subcmds[@]}" ; do - case $subcmd in - ("$2"*) printf '%s\n' "$subcmd" ;; - esac - done - done - } + openssl list -commands \ + -cipher-commands \ + -digest-commands ) } complete -F _openssl -o bashdefault -o default openssl |