#compdef dysk

autoload -U is-at-least

_dysk() {
    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[@]}" : \
'--color=[whether to have styles and colors]:color:(auto yes no)' \
'--remote-stats=[fetch stats of remote volumes]:choice:(auto yes no)' \
'-c+[columns, eg \`-c +inodes\` or \`-c id+dev+default\`]:columns: ' \
'--cols=[columns, eg \`-c +inodes\` or \`-c id+dev+default\`]:columns: ' \
'-f+[filter, eg \`-f '\''(size<35G | remote=false) & type=xfs'\''\`]:expr: ' \
'--filter=[filter, eg \`-f '\''(size<35G | remote=false) & type=xfs'\''\`]:expr: ' \
'-s+[sort, eg \`inodes\`, \`type-desc\`, or \`size-asc\`]:sort: ' \
'--sort=[sort, eg \`inodes\`, \`type-desc\`, or \`size-asc\`]:sort: ' \
'-u+[units\: \`SI\` (SI norm), \`binary\` (1024 based), or \`bytes\` (raw number)]:unit: ' \
'--units=[units\: \`SI\` (SI norm), \`binary\` (1024 based), or \`bytes\` (raw number)]:unit: ' \
'--csv-separator=[CSV separator]:sep: ' \
'--help[print help information]' \
'--version[print the version]' \
'-a[show all mount points]' \
'--all[show all mount points]' \
'--ascii[use only ASCII characters for table rendering]' \
'--list-cols[list the column names which can be used in -s, -f, or -c]' \
'-j[output as JSON]' \
'--json[output as JSON]' \
'--csv[output as CSV]' \
'::path -- if provided, only the device holding this path will be shown:_files' \
&& ret=0
}

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

if [ "$funcstack[1]" = "_dysk" ]; then
    _dysk "$@"
else
    compdef _dysk dysk
fi
