#compdef pstree

_pstree() {
  _arguments -C \
    '*:file:_files' \
    '-f[Read input from file instead of running ps -kaxwwo user,pid,ppid,pgid,command]' \
    '-g[Use graphics chars for tree. n = 1: IBM-850, n = 2: VT100, n = 3: UTF8]' \
    '-l[Show a maximum of n levels]' \
    '-p[Show only parents and descendants of the process pid]' \
    '-s[Show only parents and descendants of processes containing the string]' \
    '-U[Do not show branches containing only root processes]' \
    '-u[Show only parents and descendants of processes of user]' \
    '-w[Wide output, not truncated to terminal width]'
}

_pstree
