2 # Bash completion script for tio.
7 local cur prev opts base ttys
9 cur="${COMP_WORDS[COMP_CWORD]}"
10 prev="${COMP_WORDS[COMP_CWORD-1]}"
12 # The options we'll complete.
28 # Complete the arguments to the options.
31 local baudrates="@baudrates@"
32 COMPREPLY=( $(compgen -W "$baudrates" -- ${cur}) )
36 COMPREPLY=( $(compgen -W "5 6 7 8" -- ${cur}) )
40 COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
44 COMPREPLY=( $(compgen -W "hard soft none" -- ${cur}) )
48 COMPREPLY=( $(compgen -W "1 2" -- ${cur}) )
52 COMPREPLY=( $(compgen -W "even odd none" -- ${cur}) )
56 COMPREPLY=( $(compgen -W "0 1 10 100" -- ${cur}) )
59 -n | --no-autoconnect)
60 COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
64 COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
68 COMPREPLY=( $(compgen -W "ICRNL IGNCR INLCR INLCRNL OCRNL ODELBS ONLCRNL" -- ${cur}) )
72 COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
76 COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
80 COMPREPLY=( $(compgen -W "$(seq 0 255)" -- ${cur}) )
84 COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
88 COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
96 COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
101 if [ -d /dev/serial/by-id ]; then
102 ttys=$(printf '%s\n' /dev/tty* /dev/serial/by-id/*)
104 ttys=$(printf '%s\n' /dev/tty*)
106 COMPREPLY=( $(compgen -W "${ttys}" -- ${cur}) )
110 # Bind completion to tio command
111 complete -o default -F _tio tio