Skip to content

Commit d6977fc

Browse files
committed
feat(ssh-keygen): complete -r/-Y specific -O args
1 parent b49ab1d commit d6977fc

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

completions/ssh-keygen

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ _comp_cmd_ssh_keygen()
6868
generator=
6969
)
7070
;;
71+
*\ -*r\ *)
72+
opts=(hashalg=)
73+
;;
7174
*\ -*s\ *)
7275
opts=(
7376
clear critical: extension: force-command=
@@ -84,6 +87,9 @@ _comp_cmd_ssh_keygen()
8487
resident user= verify-required write-attestation=
8588
)
8689
;;
90+
*\ -*Y\ *)
91+
opts=(hashalg= print-pubkey verify-time)
92+
;;
8793
esac
8894
((${#opts[@]})) &&
8995
_comp_compgen -- -W '"${opts[@]}"'
@@ -106,6 +112,19 @@ _comp_cmd_ssh_keygen()
106112
user=*)
107113
_comp_compgen -c "${cur#*=}" -- -u
108114
;;
115+
hashalg=*)
116+
local -a args=()
117+
case ${words[*]} in
118+
*\ -*Y\ *)
119+
args=(sha256 sha512)
120+
;;
121+
*\ -*r\ *)
122+
args=(sha1 sha256)
123+
;;
124+
esac
125+
((${#args[@]})) &&
126+
_comp_compgen -c "${cur#*=}" -- -W '"${args[@]}"'
127+
;;
109128
esac
110129
fi
111130
return

test/t/test_ssh_keygen.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,3 +89,11 @@ def test_O_application_ssh_colon(self, completion):
8989
)
9090
def test_O_application_nonexistent(self, completion):
9191
assert not completion
92+
93+
@pytest.mark.complete("ssh-keygen -r -O ")
94+
def test_r_O(self, completion):
95+
assert completion
96+
97+
@pytest.mark.complete("ssh-keygen -Y -O ")
98+
def test_Y_O(self, completion):
99+
assert completion

0 commit comments

Comments
 (0)