File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -46,7 +46,8 @@ _comp_cmd_openssl()
4646
4747 if (( cword == 1 )) ; then
4848 local commands
49- commands=" $( " $1 " help 2>&1 | command sed -e ' /commands\|help:/d' ) "
49+ # We only want the standard commands, so we delete everything starting after and including "Message Digest commands"
50+ commands=" $( " $1 " help 2>&1 | command sed -e ' /Standard commands/d;/help:/d' -e ' /Message Digest commands/,$d' ) "
5051 _comp_compgen -- -W " $commands "
5152 else
5253 command=${words[1]}
@@ -110,6 +111,11 @@ _comp_cmd_openssl()
110111 dgst | req | x509)
111112 _comp_compgen -a -i openssl digests " $1 "
112113 ;;
114+ enc)
115+ # The -list option was added in openssl 1.1.1e, so we ignore the error here.
116+ # We do get some of the ciphers "by accident", since some are detected in the help output.
117+ _comp_compgen -a split -- " $( " $1 " enc -list 2> /dev/null | command sed ' /Supported ciphers:/d' ) "
118+ ;;
113119 esac
114120 else
115121 if [[ $command == speed ]]; then
Original file line number Diff line number Diff line change @@ -5,9 +5,7 @@ class TestOpenssl:
55 @pytest .mark .complete ("openssl " , require_cmd = True )
66 def test_1 (self , completion ):
77 assert completion
8- assert all (
9- x in completion for x in "md5 x509 aes-128-cbc dgst pkey" .split ()
10- )
8+ assert all (x in completion for x in "x509 dgst enc pkey" .split ())
119
1210 @pytest .mark .complete ("openssl pkey -cipher " , require_cmd = True )
1311 def test_2 (self , completion ):
@@ -17,3 +15,8 @@ def test_2(self, completion):
1715 def test_3 (self , completion ):
1816 assert completion
1917 assert any (x .startswith ("-sha" ) for x in completion )
18+
19+ @pytest .mark .complete ("openssl enc -a" , require_cmd = True )
20+ def test_4 (self , completion ):
21+ assert completion
22+ assert any (x .startswith ("-aes" ) for x in completion )
You can’t perform that action at this time.
0 commit comments