54 lines
1.3 KiB
Plaintext
Raw Normal View History

2009-01-19 21:52:54 +01:00
# bash completion for minicom
have minicom || return
2009-01-19 21:52:54 +01:00
_minicom()
{
local cur prev words cword
_init_completion || return
2009-01-19 21:52:54 +01:00
2009-10-04 19:42:50 +02:00
case $prev in
-a|-c)
2009-10-04 19:42:50 +02:00
COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) )
return 0
;;
-S|-C)
2009-10-04 19:42:50 +02:00
_filedir
return 0
;;
-P)
2009-12-20 23:44:33 +02:00
COMPREPLY=( $( printf '%s\n' /dev/tty* ) )
2009-10-04 19:42:50 +02:00
COMPREPLY=( $( compgen -W '${COMPREPLY[@]} ${COMPREPLY[@]#/dev/}' \
-- "$cur" ) )
return 0
;;
esac
2009-01-19 21:52:54 +01:00
2009-10-04 19:42:50 +02:00
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-s -o -m -M -z -l -L -w -a -t \
-c -S -d -p -C -T -7 -8' -- "$cur" ) )
return 0
else
local confdir
2009-10-04 19:42:50 +02:00
[ -n "$( command ls /etc/minirc.* 2>/dev/null)" ] \
&& confdir=/etc
[ -n "$( command ls /etc/minicom/minirc.* 2>/dev/null)" ] \
&& confdir=/etc/minicom
if [ -n "$confdir" ]; then
2009-12-20 23:44:33 +02:00
COMPREPLY=( $( compgen -W '$( printf "%s\n" $confdir/minirc.* | \
2009-10-04 19:42:50 +02:00
sed -e "s|$confdir/minirc.||")' -- "$cur" ) )
return 0
fi
fi
2009-01-19 21:52:54 +01:00
} &&
complete -F _minicom -o default minicom
# Local variables:
# mode: shell-script
2009-10-04 19:42:50 +02:00
# sh-basic-offset: 4
# sh-indent-comment: t
2009-10-04 19:42:50 +02:00
# indent-tabs-mode: nil
# End:
2009-10-04 19:42:50 +02:00
# ex: ts=4 sw=4 et filetype=sh