# bash completion for minicom -*- shell-script -*- proc _minicom { var cur = '', prev = '', words = '', cword = '' _init_completion || return match $prev { with -a|-c setglobal COMPREPLY = '( '$( compgen -W 'on off' -- "$cur" ) ) return 0 with -S|-C _filedir return 0 with -P setglobal COMPREPLY = '( '$( printf '%s\n' /dev/tty* ) ) setglobal COMPREPLY = '( '$( compgen -W '${COMPREPLY[@]} ${COMPREPLY[@]#/dev/}' \ -- "$cur" ) ) return 0 } if [[ "$cur" == -* ]] { setglobal 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 { setglobal COMPREPLY = '( '$( command ls /etc/minirc.* /etc/minicom/minirc.* ~/.minirc.* \ 2>/dev/null | sed 's|^.*minirc\.||' | \ grep "^${cur}" ) ) [[ $COMPREPLY ]] && return } } && complete -F _minicom -o default minicom # ex: ts=4 sw=4 et filetype=sh