Skip to content

Commit fb46fed

Browse files
committed
screen: add serial device basic arg (non)completion
1 parent 7a8e408 commit fb46fed

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

completions/screen

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,14 @@ _screen()
3939
fi
4040

4141
case ${words[1]} in
42+
/dev*)
43+
if ((cword == 2)); then
44+
COMPREPLY=( $(compgen -W '110 300 600 1200 2400 4800 9600 \
45+
14400 19200 38400 57600 115200 128000 256000' -- "$cur") )
46+
# TODO more, comma separated options
47+
fi
48+
return
49+
;;
4250
//telnet)
4351
((cword == 2)) && _known_hosts_real -- "$cur"
4452
return

test/t/test_screen.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,11 @@ def test_telnet_first_arg(self, completion):
3838
@pytest.mark.complete("screen //telnet foo ", env=dict(HOME="$PWD/shared"))
3939
def test_telnet_other_args(self, completion):
4040
assert not completion
41+
42+
@pytest.mark.complete("screen /dev/ttyUSB0 ")
43+
def test_serial_2nd_arg(self, completion):
44+
assert "19200" in completion
45+
46+
@pytest.mark.complete("screen /dev/ttyUSB0 9600 ")
47+
def test_serial_3rdplus_arg(self, completion):
48+
assert not completion

0 commit comments

Comments
 (0)