On Sun, 22 Mar 2026 18:02:42 -0400 "Jay Berkenbilt"  wrote:
> I'm working on a complete redo of the competition support. Hopefully that can 
> put an end to this once and for all. Sorry for the formatting... Sending from 
> my phone.

Whilst we wait for that complete redo, here's a duct tape fix:

# Save to /etc/bash_completion.d/qpdf

_qpdf_completions() {
  local IFS=$' \t\n'

  local cur; cur="${COMP_WORDS[COMP_CWORD]}"

  if [[ "${cur}" == -* ]]
  then
    if [[ ! "${_QPDF_OPTS:-}" ]]
    then
      _QPDF_OPTS=$(man qpdf 2>/dev/null |
        col --no-backspaces |
        grep --only-matching --extended-regexp 
'\-\-[[:alnum:]-]+|\-[[:alnum:]]+' |
        sort --unique |
        tr '\n' ' ')
    fi
    COMPREPLY=( $(compgen -W "${_QPDF_OPTS}" -- "${cur}") )
    return 0
  fi
  COMPREPLY=( $(compgen -f -X '!*.pdf' -- "${cur}") )
}

complete -F _qpdf_completions qpdf

Reply via email to