_uu-ptx() {
    local i cur prev opts cmds
    COMPREPLY=()
    cur="${COMP_WORDS[COMP_CWORD]}"
    prev="${COMP_WORDS[COMP_CWORD-1]}"
    cmd=""
    opts=""

    for i in ${COMP_WORDS[@]}
    do
        case "${i}" in
            uu-ptx)
                cmd="uu-ptx"
                ;;
            
            *)
                ;;
        esac
    done

    case "${cmd}" in
        uu-ptx)
            opts=" -A -G -O -R -T -f -r -h -V -F -M -S -W -b -g -i -o -w  --auto-reference --traditional --format=roff --right-side-refs --format=tex --ignore-case --references --help --version --flag-truncation --macro-name --sentence-regexp --word-regexp --break-file --gap-size --ignore-file --only-file --width  <file>... "
            if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
                COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
                return 0
            fi
            case "${prev}" in
                
                --flag-truncation)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                    -F)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --macro-name)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                    -M)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --sentence-regexp)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                    -S)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --word-regexp)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                    -W)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --break-file)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                    -b)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --gap-size)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                    -g)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --ignore-file)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                    -i)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --only-file)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                    -o)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                --width)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                    -w)
                    COMPREPLY=($(compgen -f "${cur}"))
                    return 0
                    ;;
                *)
                    COMPREPLY=()
                    ;;
            esac
            COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
            return 0
            ;;
        
    esac
}

complete -F _uu-ptx -o bashdefault -o default uu-ptx
