aboutsummaryrefslogtreecommitdiff
path: root/bash/bash_completion.d/openssl.bash
blob: 86650770e401bda23d256222cde6146f9bf0867f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Some simple completion for openssl(1ssl)
_openssl() {

    # Only complete the first word: OpenSSL subcommands
    case $COMP_CWORD in
        1)
            while read -r subcmd ; do
                case $subcmd in
                    '') ;;
                    "${COMP_WORDS[COMP_CWORD]}"*)
                        COMPREPLY[${#COMPREPLY[@]}]=$subcmd
                        ;;
                esac
            done < <(
                for arg in \
                list-cipher-commands \
                list-standard-commands \
                list-message-digest-commands ; do
                    printf '%s\n' "$arg"
                    openssl "$arg"
                done
            )
            ;;
    esac
}
complete -F _openssl -o bashdefault -o default openssl