Skip to content

Commit 01b3aa2

Browse files
committed
feat(openssl): Complete encryption algos for enc
Also add test to verify
1 parent 6fb0827 commit 01b3aa2

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

completions/openssl

+5
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,11 @@ _comp_cmd_openssl()
111111
dgst | req | x509)
112112
_comp_compgen -a -i openssl digests "$1"
113113
;;
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+
;;
114119
esac
115120
else
116121
if [[ $command == speed ]]; then

test/t/test_openssl.py

+5
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,8 @@ def test_2(self, completion):
1515
def test_3(self, completion):
1616
assert completion
1717
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)

0 commit comments

Comments
 (0)