#compdef herdr
_herdr() {
    local -a completions=("${(@f)$( \
        _CLAP_IFS=$'\n' \
        _CLAP_COMPLETE_INDEX=$((CURRENT - 1)) \
        HERDR_COMPLETE="zsh" \
        'herdr' -- "${words[@]}" 2>/dev/null \
    )}")
    local -a dirs=() other=()
    local completion value
    for completion in $completions; do
        [[ -n $completion ]] || continue
        value=${completion%%:*}
        if [[ $value == */ ]]; then
            dirs+=("${value%/}${completion#$value}")
        else
            other+=("$completion")
        fi
    done
    [[ -n $dirs ]] && _describe -V 'values' dirs -S '/' -r '/'
    [[ -n $other ]] && _describe -V 'values' other
}
if [[ $funcstack[1] == _herdr ]]; then
    _herdr "$@"
else
    compdef _herdr herdr
fi
