Skip to content

Commit 6fb0827

Browse files
committed
feat(openssl): show only standard commands
We used to also complete digest and encryption algorithms as top level commands, but they can all be used by the `dgst` and `enc` commands. This also makes this work on the BSD sed version that comes with macos. See #1324 fix(openssl): Make command extraction from help portable for BSD sed.
1 parent 4ac918f commit 6fb0827

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

completions/openssl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff 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]}

test/t/test_openssl.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff 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):

0 commit comments

Comments
 (0)