Add shell completion of sub-configuration names

Does not work with sub configuration names that contains one or more
white spaces.
This commit is contained in:
Martin Lund 2022-10-16 23:01:08 +02:00
parent bf7b032649
commit a97b2c00cd
6 changed files with 90 additions and 30 deletions

View file

@ -159,12 +159,14 @@ _tio()
;;
esac
sub_configs="`tio --complete-sub-configs`"
if [ -d /dev/serial/by-id ]; then
ttys=$(printf '%s\n' /dev/tty* /dev/serial/by-id/*)
else
ttys=$(printf '%s\n' /dev/tty*)
fi
COMPREPLY=( $(compgen -W "${ttys}" -- ${cur}) )
COMPREPLY=( $(compgen -W "${ttys} ${sub_configs}" -- ${cur}) )
return 0
}