Skip to content

Commit d07e980

Browse files
committed
feat(ssh-keyscan): new completion
1 parent 5e9c9a0 commit d07e980

File tree

5 files changed

+56
-0
lines changed

5 files changed

+56
-0
lines changed

completions/Makefile.am

+1
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,7 @@ bashcomp_DATA = 2to3 \
394394
ssh-add \
395395
ssh-copy-id \
396396
ssh-keygen \
397+
ssh-keyscan \
397398
sshfs \
398399
sshmitm \
399400
sshow \

completions/ssh-keyscan

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# ssh-keyscan(1) completion -*- shell-script -*-
2+
3+
_comp_cmd_ssh_keyscan()
4+
{
5+
local cur prev words cword
6+
_init_completion || return
7+
8+
local ipvx
9+
10+
case $prev in
11+
-*4*)
12+
ipvx=-4
13+
;;
14+
-*6*)
15+
ipvx=-6
16+
;;
17+
-*f)
18+
_filedir
19+
return
20+
;;
21+
-*p | -*T)
22+
return
23+
;;
24+
-*t)
25+
COMPREPLY=($(compgen -W 'dsa ecdsa ed25519 rsa' -- "$cur"))
26+
return
27+
;;
28+
esac
29+
30+
if [[ $cur == -* ]]; then
31+
COMPREPLY=($(compgen -W '$(_parse_usage "$1")' -- "$cur"))
32+
return
33+
fi
34+
35+
_known_hosts_real ${ipvx-} -- "$cur"
36+
} &&
37+
complete -F _comp_cmd_ssh_keyscan ssh-keyscan
38+
39+
# ex: filetype=sh

test/t/Makefile.am

+1
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,7 @@ EXTRA_DIST = \
573573
test_ssh_add.py \
574574
test_ssh_copy_id.py \
575575
test_ssh_keygen.py \
576+
test_ssh_keyscan.py \
576577
test_sshfs.py \
577578
test_sshmitm.py \
578579
test_sshow.py \

test/t/test_ssh_keyscan.py

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import pytest
2+
3+
4+
@pytest.mark.bashcomp(
5+
cmd="ssh-keyscan",
6+
)
7+
class TestSshKeyscan:
8+
@pytest.mark.complete("ssh-keyscan ")
9+
def test_basic(self, completion):
10+
assert completion
11+
12+
@pytest.mark.complete("ssh-keyscan -", require_cmd=True)
13+
def test_options(self, completion):
14+
assert completion

test/test-cmd-list.txt

+1
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,7 @@ ssh
351351
ssh-add
352352
ssh-copy-id
353353
ssh-keygen
354+
ssh-keyscan
354355
sshmitm
355356
sshow
356357
strace

0 commit comments

Comments
 (0)