tio/src/bash-completion/tio.in
Martin Lund b2aafd696b Add special character map feature
Add a --map option which allows to map special characters, in particular CR and
NL characters which are used in various combinations on varios platforms.
2017-11-05 23:10:12 +01:00

81 lines
2.1 KiB
Text

#
# Bash completion script for tio.
#
_tio()
{
local cur prev opts base
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
# The options we'll complete.
opts="-b --baudrate \
-d --databits \
-f --flow \
-s --stopbits \
-p --parity \
-o --output-delay \
-n --no-autoconnect \
-l --log \
-m --map \
-v --version \
-h --help"
# Complete the arguments to the options.
case "${prev}" in
-b | --baudrate)
local baudrates="@BAUDRATES@"
COMPREPLY=( $(compgen -W "$baudrates" -- ${cur}) )
return 0
;;
-d | --databits)
COMPREPLY=( $(compgen -W "5 6 7 8" -- ${cur}) )
return 0
;;
-f | --flow)
COMPREPLY=( $(compgen -W "hard soft none" -- ${cur}) )
return 0
;;
-s | --stopbits)
COMPREPLY=( $(compgen -W "1 2" -- ${cur}) )
return 0
;;
-p | --parity)
COMPREPLY=( $(compgen -W "even odd none" -- ${cur}) )
return 0
;;
-o | --output-delay)
COMPREPLY=( $(compgen -W "0 1 10 100" -- ${cur}) )
return 0
;;
-n | --no-autoconnect)
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
;;
-l | --log)
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
;;
-m | --map)
COMPREPLY=( $(compgen -W "INLCR IGNCR ICRNL ONLCR OCRNL" -- ${cur}) )
return 0
;;
-v | --version)
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
;;
-h | --help)
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
;;
*)
;;
esac
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
return 0
}
# Bind completion to tio command
complete -o default -F _tio tio