diff options
Diffstat (limited to '')
-rw-r--r-- | completions/op | 59 | ||||
-rw-r--r-- | completions/openssl | 85 | ||||
-rw-r--r-- | completions/opera | 23 | ||||
-rw-r--r-- | completions/optipng | 27 |
4 files changed, 67 insertions, 127 deletions
diff --git a/completions/op b/completions/op deleted file mode 100644 index 31d6475..0000000 --- a/completions/op +++ /dev/null @@ -1,59 +0,0 @@ -# op (1Password CLI) completion -*- shell-script -*- - -_op_commands() -{ - "$@" --help 2>/dev/null | - awk '/^(Available |Sub)commands/{flag=1;next}/^ /&&flag{print $1}' -} - -_op_command_options() -{ - case $cur in - -*) - for i in "${!words[@]}"; do - [[ ${words[i]} == -* || $i -eq 0 ]] && unset "words[i]" - done - COMPREPLY=($(compgen -W \ - '$(_parse_usage "$1" "${words[*]} --help") --help' -- "$cur")) - [[ ${COMPREPLY-} == *= ]] && compopt -o nospace - return 0 - ;; - esac - return 1 -} - -_op() -{ - local cur prev words cword split - _init_completion -s || return - - local command i - for ((i = 1; i < cword; i++)); do - case ${words[i]} in - --help | --version) return ;; - -*) ;; - *) - command=${words[i]} - break - ;; - esac - done - - if [[ ! -v command && $cur == -* ]]; then - COMPREPLY=($(compgen -W '$(_parse_usage "$1" --help)' -- "$cur")) - [[ ${COMPREPLY-} == *= ]] && compopt -o nospace - return - fi - - [[ -v command ]] && _op_command_options "$1" && return - - if [[ ! -v command || $command == "$prev" ]]; then - COMPREPLY=($(compgen -W '$(_op_commands "$1" ${command-})' -- "$cur")) - [[ ${COMPREPLY-} ]] && return - fi - - # TODO specific command and subcommand completions -} && - complete -F _op op - -# ex: filetype=sh diff --git a/completions/openssl b/completions/openssl index dd77092..9dad715 100644 --- a/completions/openssl +++ b/completions/openssl @@ -1,52 +1,54 @@ # bash completion for openssl -*- shell-script -*- -_openssl_sections() +_comp_cmd_openssl__compgen_sections() { - local config f + local config="" _i _file # check if a specific configuration file is used - for ((i = 2; i < cword; i++)); do - if [[ ${words[i]} == -config ]]; then - config=${words[i + 1]} + for ((_i = 2; _i < cword; _i++)); do + if [[ ${words[_i]} == -config ]]; then + config=${words[_i + 1]} break fi done # if no config given, check some usual default locations - if [[ -z $config ]]; then - for f in /etc/ssl/openssl.cnf /etc/pki/tls/openssl.cnf \ + if [[ ! $config ]]; then + for _file in /etc/ssl/openssl.cnf /etc/pki/tls/openssl.cnf \ /usr/share/ssl/openssl.cnf; do - [[ -f $f ]] && config=$f && break + [[ -f $_file ]] && config=$_file && break done fi [[ ! -f $config ]] && return - COMPREPLY=($(compgen -W "$(awk '/\[.*\]/ {print $2}' $config)" -- "$cur")) + _comp_compgen -U config split -- "$(_comp_awk '/\[.*\]/ {print $2}' "$config")" } -_openssl_digests() +_comp_cmd_openssl__compgen_digests() { - "$1" dgst -h 2>&1 | - awk '/^-.*[ \t]to use the .* message digest algorithm/ { print $1 }' - local -a digests=($("$1" help 2>&1 | + [[ $cur == -* ]] || return + _comp_compgen_split -- "$( + "$1" dgst -h 2>&1 | + _comp_awk '/^-.*[ \t]to use the .* message digest algorithm/ { print $1 }' + )" + _comp_compgen -ac "${cur#-}" split -P "-" -- "$("$1" help 2>&1 | command sed -ne '/^Message Digest commands/,/^[[:space:]]*$/p' | - command sed -e 1d)) - printf "%s\n" "${digests[@]/#/-}" + command sed -e 1d)" } -_openssl() +_comp_cmd_openssl() { - local cur prev words cword - _init_completion || return + local cur prev words cword comp_args + _comp_initialize -- "$@" || return - local commands command options formats + local commands command formats commands='asn1parse ca ciphers crl crl2pkcs7 dgst dh dhparam dsa dsaparam ec ecparam enc engine errstr gendh gendsa genrsa nseq ocsp passwd pkcs12 pkcs7 pkcs8 prime rand req rsa rsautl s_client s_server s_time - sess_id smime speed spkac verify version x509 md2 md4 md5 rmd160 sha - sha1 aes-128-cbc aes-128-ecb aes-192-cbc aes-192-ecb aes-256-cbc + sess_id smime speed spkac storeutl verify version x509 md2 md4 md5 rmd160 + sha sha1 aes-128-cbc aes-128-ecb aes-192-cbc aes-192-ecb aes-256-cbc aes-256-ecb base64 bf bf-cbc bf-cfb bf-ecb bf-ofb camellia-128-cbc camellia-128-ecb camellia-192-cbc camellia-192-ecb camellia-256-cbc camellia-256-ecb cast cast-cbc cast5-cbc cast5-cfb cast5-ecb cast5-ofb @@ -56,7 +58,7 @@ _openssl() sha224 sha256 sha384 sha512 genpkey pkey pkeyparam pkeyutl' if ((cword == 1)); then - COMPREPLY=($(compgen -W "$commands" -- "$cur")) + _comp_compgen -- -W "$commands" else command=${words[1]} case $prev in @@ -65,15 +67,15 @@ _openssl() -out | -oid | -paramfile | -peerkey | -prvrify | -rand | -recip | -revoke | \ -sess_in | -sess_out | -spkac | -sigfile | -sign | -signkey | -signer | \ -signature | -ss_cert | -untrusted | -verify | -writerand) - _filedir + _comp_compgen_filedir return ;; -outdir | -CApath) - _filedir -d + _comp_compgen_filedir -d return ;; -name | -crlexts | -extensions) - _openssl_sections + _comp_cmd_openssl__compgen_sections return ;; -inform | -outform | -keyform | -certform | -CAform | -CAkeyform | -dkeyform | \ @@ -90,49 +92,48 @@ _openssl() formats+=" ENGINE" ;; esac - COMPREPLY=($(compgen -W "$formats" -- "$cur")) + _comp_compgen -- -W "$formats" return ;; -connect) - _known_hosts_real -- "$cur" + _comp_compgen_known_hosts -- "$cur" return ;; -starttls) - COMPREPLY=($(compgen -W ' - smtp pop3 imap ftp xmpp xmpp-server telnet irc mysql - postgres lmtp nntp sieve ldap - ' -- "$cur")) + _comp_compgen -- -W ' smtp pop3 imap ftp xmpp xmpp-server + telnet irc mysql postgres lmtp nntp sieve ldap' return ;; -cipher) - COMPREPLY=($(IFS=: compgen -W "$($1 ciphers)" -- "$cur")) + _comp_compgen_split -F : -- "$("$1" ciphers)" return ;; -kdf) - COMPREPLY=($(compgen -W 'TLS1-PRF HKDF' -- "$cur")) + _comp_compgen -- -W 'TLS1-PRF HKDF' return ;; esac if [[ $cur == -* ]]; then # possible options for the command - options=$(_parse_help "$1" "$command -help" 2>/dev/null) + _comp_compgen_help -- "$command" -help case $command in - dgst | req | x509) options+=" $(_openssl_digests $1)" ;; + dgst | req | x509) + _comp_compgen -a -i openssl digests "$1" + ;; esac - COMPREPLY=($(compgen -W "$options" -- "$cur")) else if [[ $command == speed ]]; then - COMPREPLY=($(compgen -W 'md2 mdc2 md5 hmac sha1 rmd160 - idea-cbc rc2-cbc rc5-cbc bf-cbc des-cbc des-ede3 rc4 - rsa512 rsa1024 rsa2048 rsa4096 dsa512 dsa1024 dsa2048 idea - rc2 des rsa blowfish' -- "$cur")) + _comp_compgen -- -W 'md2 mdc2 md5 hmac sha1 rmd160 idea-cbc + rc2-cbc rc5-cbc bf-cbc des-cbc des-ede3 rc4 rsa512 rsa1024 + rsa2048 rsa4096 dsa512 dsa1024 dsa2048 idea rc2 des rsa + blowfish' else - _filedir + _comp_compgen_filedir fi fi fi } && - complete -F _openssl -o default openssl + complete -F _comp_cmd_openssl -o default openssl # ex: filetype=sh diff --git a/completions/opera b/completions/opera index f2bc8c3..c9245e4 100644 --- a/completions/opera +++ b/completions/opera @@ -1,29 +1,28 @@ # opera(1) completion -*- shell-script -*- -_opera() +_comp_cmd_opera() { - local cur prev words cword - _init_completion || return + local cur prev words cword comp_args + _comp_initialize -- "$@" || return case "$prev" in ?(-)-widget | ?(-)-urllist | ?(-)-uiparserlog | ?(-)-uiwidgetsparserlog | \ ?(-)-profilinglog) - _filedir + _comp_compgen_filedir return ;; ?(-)-[psb]d) - _filedir -d + _comp_compgen_filedir -d return ;; ?(-)-remote) - COMPREPLY=($(compgen -W 'openURL\\( openFile\\( openM2\\( - openComposer\\( addBookmark\\( raise\\(\\) lower\\(\\)' \ - -- "$cur")) + _comp_compgen -- -W 'openURL\\( openFile\\( openM2\\( + openComposer\\( addBookmark\\( raise\\(\\) lower\\(\\)' [[ ${COMPREPLY-} == *\( ]] && compopt -o nospace return ;; ?(-)-windowname) - COMPREPLY=($(compgen -W 'first last opera{1..9}' -- "$cur")) + _comp_compgen -- -W 'first last opera{1..9}' return ;; ?(-)-geometry | ?(-)-window | ?(-)-display | ?(-)-urllistloadtimeout | \ @@ -35,13 +34,13 @@ _opera() esac if [[ $cur == -* ]]; then - COMPREPLY=($(compgen -W '$(_parse_help "$1" -help)' -- "$cur")) + _comp_compgen_help -- -help [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi - _filedir '@(?([xX]|[sS])[hH][tT][mM]?([lL]))' + _comp_compgen_filedir '@(?([xX]|[sS])[hH][tT][mM]?([lL]))' } && - complete -F _opera opera + complete -F _comp_cmd_opera opera # ex: filetype=sh diff --git a/completions/optipng b/completions/optipng index 0f6b40e..a81ffa2 100644 --- a/completions/optipng +++ b/completions/optipng @@ -1,52 +1,51 @@ # optipng(1) completion -*- shell-script -*- -_optipng() +_comp_cmd_optipng() { - local cur prev words cword - _init_completion || return + local cur prev words cword comp_args + _comp_initialize -- "$@" || return case $prev in -'?' | -h | --help | -f) return ;; -o) - COMPREPLY=($(compgen -W '{0..7}' -- "$cur")) + _comp_compgen -- -W '{0..7}' return ;; -out | -log) - _filedir + _comp_compgen_filedir return ;; -dir) - _filedir -d + _comp_compgen_filedir -d return ;; -i) - COMPREPLY=($(compgen -W '0 1' -- "$cur")) + _comp_compgen -- -W '0 1' return ;; -zc | -zm) - COMPREPLY=($(compgen -W '{1..9}' -- "$cur")) + _comp_compgen -- -W '{1..9}' return ;; -zw) - COMPREPLY=($(compgen -W '256 512 1k 2k 4k 8k 16k 32k' \ - -- "$cur")) + _comp_compgen -- -W '256 512 1k 2k 4k 8k 16k 32k' return ;; -strip) - COMPREPLY=($(compgen -W 'all' -- "$cur")) + _comp_compgen -- -W 'all' return ;; esac if [[ $cur == -* ]]; then - COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) + _comp_compgen_help return fi - _filedir '@(png|bmp|gif|pnm|tif?(f))' + _comp_compgen_filedir '@(png|bmp|gif|pnm|tif?(f))' } && - complete -F _optipng optipng + complete -F _comp_cmd_optipng optipng # ex: filetype=sh |