aboutsummaryrefslogtreecommitdiff
path: root/2018-linuxdays/examples/bash/real
blob: 2dd3f3653afa85136042d27546990f65588bc3b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Bash completion file for sterm
# vim: ft=sh

_sterm() {
	local cur prev words cword
	_init_completion || return
	local ops="-h --help -c -d -e -n -r -s -v"
	case "$prev" in
		-b|-d|-r)
			# No completion for these
			;;
		-s)
			local speeds="0 50 75 110 134 150 200 300 600 1200 1800 2400 4800 9600 19200 38400 57600 115200 230400"
			COMPREPLY+=($(compgen -W "${speeds}" -- ${cur}))
			;;
		*)
			COMPREPLY+=($(compgen -W "${ops}" -- ${cur}))
			COMPREPLY+=($(compgen -G "/dev/tty*" -- ${cur}))
			;;
	esac
}

complete -o default -F _sterm sterm