function _pyxstitch() { local cur opts if [ $COMP_CWORD -eq 1 ]; then cur=${COMP_WORDS[COMP_CWORD]} opts=$(pyxstitch --help | sed "s/^\s*//g;s/, //g;s/^-h//g" | grep "^\-" | cut -d " " -f 1) COMPREPLY=( $(compgen -W "$opts" -- $cur) ) fi } complete -F _pyxstitch pyxstitch