File tree 2 files changed +13
-4
lines changed
2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -46,7 +46,8 @@ _comp_cmd_openssl()
46
46
47
47
if (( cword == 1 )) ; then
48
48
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' ) "
50
51
_comp_compgen -- -W " $commands "
51
52
else
52
53
command=${words[1]}
@@ -110,6 +111,11 @@ _comp_cmd_openssl()
110
111
dgst | req | x509)
111
112
_comp_compgen -a -i openssl digests " $1 "
112
113
;;
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
+ ;;
113
119
esac
114
120
else
115
121
if [[ $command == speed ]]; then
Original file line number Diff line number Diff line change @@ -5,9 +5,7 @@ class TestOpenssl:
5
5
@pytest .mark .complete ("openssl " , require_cmd = True )
6
6
def test_1 (self , completion ):
7
7
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 ())
11
9
12
10
@pytest .mark .complete ("openssl pkey -cipher " , require_cmd = True )
13
11
def test_2 (self , completion ):
@@ -17,3 +15,8 @@ def test_2(self, completion):
17
15
def test_3 (self , completion ):
18
16
assert completion
19
17
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