#compdef df

autoload -U is-at-least

_df() {
    typeset -A opt_args
    typeset -a _arguments_options
    local ret=1

    if is-at-least 5.2; then
        _arguments_options=(-s -S -C)
    else
        _arguments_options=(-s -C)
    fi

    local context curcontext="$curcontext" state line
    _arguments "${_arguments_options[@]}" : \
'-B+[df-help-block-size]:SIZE:_default' \
'--block-size=[df-help-block-size]:SIZE:_default' \
'(-i --inodes -P --portability -T --print-type)*--output=[df-help-output]' \
'*-t+[df-help-type]:TYPE:_default' \
'*--type=[df-help-type]:TYPE:_default' \
'*-x+[df-help-exclude-type]:TYPE:_default' \
'*--exclude-type=[df-help-exclude-type]:TYPE:_default' \
'--help[df-help-print-help]' \
'-a[df-help-all]' \
'--all[df-help-all]' \
'--total[df-help-total]' \
'-h[df-help-human-readable]' \
'--human-readable[df-help-human-readable]' \
'-H[df-help-si]' \
'--si[df-help-si]' \
'-i[df-help-inodes]' \
'--inodes[df-help-inodes]' \
'-k[df-help-kilo]' \
'-l[df-help-local]' \
'--local[df-help-local]' \
'--no-sync[df-help-no-sync]' \
'-P[df-help-portability]' \
'--portability[df-help-portability]' \
'--sync[df-help-sync]' \
'-T[df-help-print-type]' \
'--print-type[df-help-print-type]' \
'-V[Print version]' \
'--version[Print version]' \
'::paths:_files' \
&& ret=0
}

(( $+functions[_df_commands] )) ||
_df_commands() {
    local commands; commands=()
    _describe -t commands 'df commands' commands "$@"
}

if [ "$funcstack[1]" = "_df" ]; then
    _df "$@"
else
    compdef _df df
fi
