diff --git a/completions/openssl b/completions/openssl index 548f6e9f6cd..3d9c381f613 100644 --- a/completions/openssl +++ b/completions/openssl @@ -27,6 +27,8 @@ _comp_cmd_openssl__compgen_sections() _comp_cmd_openssl__compgen_digests() { + #_comp_compgen -W "$($1 list )" + #set -x [[ $cur == -* ]] || return _comp_compgen_split -- "$( "$1" dgst -h 2>&1 | @@ -35,6 +37,7 @@ _comp_cmd_openssl__compgen_digests() _comp_compgen -ac "${cur#-}" split -P "-" -- "$("$1" help 2>&1 | command sed -ne '/^Message Digest commands/,/^[[:space:]]*$/p' | command sed -e 1d)" + set +x } _comp_cmd_openssl() @@ -46,7 +49,7 @@ _comp_cmd_openssl() if ((cword == 1)); then local commands - commands="$("$1" help 2>&1 | command sed -e '/commands\|help:/d')" + commands="$("$1" list -commands)" _comp_compgen -- -W "$commands" else command=${words[1]} diff --git a/test/t/test_openssl.py b/test/t/test_openssl.py index e82a75311bf..662d9aad495 100644 --- a/test/t/test_openssl.py +++ b/test/t/test_openssl.py @@ -5,9 +5,7 @@ class TestOpenssl: @pytest.mark.complete("openssl ", require_cmd=True) def test_1(self, completion): assert completion - assert all( - x in completion for x in "md5 x509 aes-128-cbc dgst pkey".split() - ) + assert all(x in completion for x in "x509 dgst pkey enc".split()) @pytest.mark.complete("openssl pkey -cipher ", require_cmd=True) def test_2(self, completion):