#compdef csview

autoload -U is-at-least

_csview() {
    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[@]}" \
'-d+[Specify the field delimiter]:DELIMITER: ' \
'--delimiter=[Specify the field delimiter]:DELIMITER: ' \
'-s+[Specify the border style]:STYLE:(None Ascii Ascii2 Sharp Rounded Reinforced Markdown Grid)' \
'--style=[Specify the border style]:STYLE:(None Ascii Ascii2 Sharp Rounded Reinforced Markdown Grid)' \
'-p+[Specify padding for table cell]:PADDING: ' \
'--padding=[Specify padding for table cell]:PADDING: ' \
'-i+[Specify global indent for table]:INDENT: ' \
'--indent=[Specify global indent for table]:INDENT: ' \
'--sniff=[Limit column widths sniffing to the specified number of rows. Specify "0" to cancel limit]:LIMIT: ' \
'-h[Print help information]' \
'--help[Print help information]' \
'-V[Print version information]' \
'--version[Print version information]' \
'-H[Specify that the input has no header row]' \
'--no-headers[Specify that the input has no header row]' \
'-n[Prepend a column of line numbers to the table]' \
'--number[Prepend a column of line numbers to the table]' \
'(-d --delimiter)-t[Use '\''\\t'\'' as delimiter for tsv]' \
'(-d --delimiter)--tsv[Use '\''\\t'\'' as delimiter for tsv]' \
'::FILE -- File to view:_files' \
&& ret=0
}

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

_csview "$@"
