2009-01-19 21:52:54 +01:00
|
|
|
# bash completion for minicom
|
|
|
|
|
2011-04-05 00:35:51 +03:00
|
|
|
have minicom || return
|
|
|
|
|
2009-01-19 21:52:54 +01:00
|
|
|
_minicom()
|
|
|
|
{
|
2011-04-20 22:42:55 +03:00
|
|
|
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
|
2009-11-22 11:43:26 +01:00
|
|
|
-a|-c)
|
2009-10-04 19:42:50 +02:00
|
|
|
COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) )
|
|
|
|
return 0
|
|
|
|
;;
|
2009-11-22 11:43:26 +01:00
|
|
|
-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
|
2011-04-20 22:42:55 +03:00
|
|
|
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
|
|
|
} &&
|
2009-10-22 12:04:29 +03:00
|
|
|
complete -F _minicom -o default minicom
|
2009-10-01 20:54:51 +03:00
|
|
|
|
|
|
|
# Local variables:
|
|
|
|
# mode: shell-script
|
2009-10-04 19:42:50 +02:00
|
|
|
# sh-basic-offset: 4
|
2009-10-01 20:54:51 +03:00
|
|
|
# sh-indent-comment: t
|
2009-10-04 19:42:50 +02:00
|
|
|
# indent-tabs-mode: nil
|
2009-10-01 20:54:51 +03:00
|
|
|
# End:
|
2009-10-04 19:42:50 +02:00
|
|
|
# ex: ts=4 sw=4 et filetype=sh
|