#compdef mcat

autoload -U is-at-least

_mcat() {
    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[@]}" : \
'-t+[Color theme]:THEME:(catppuccin nord monokai dracula gruvbox one-dark solarized tokyo-night makurai-light makurai-dark ayu ayu-mirage github synthwave material rose-pine kanagawa vscode everforest autumn spring)' \
'--theme=[Color theme]:THEME:(catppuccin nord monokai dracula gruvbox one-dark solarized tokyo-night makurai-light makurai-dark ayu ayu-mirage github synthwave material rose-pine kanagawa vscode everforest autumn spring)' \
'-o+[Output format]:format:(html md image inline interactive)' \
'--output=[Output format]:format:(html md image inline interactive)' \
'--spx=[Pixel bounding box for image rendering, auto-detected by default (e.g. 1920x1080, 1920xauto, autox1080)]:WxH:_default' \
'--sc=[Bounding box in columns x rows, auto-detected by default, affects both image sizing and markdown rendering (e.g. 100x20, 100xauto, autox20)]:WxH:_default' \
'--scalex=[Scale multiplier applied over both spx and sc width]:float:_default' \
'--scaley=[Scale multiplier applied over both spx and sc height]:float:_default' \
'--md-image=[What images to render in the markdown]:mode:(all small none auto)' \
'--timeout=[timeout for fetching images from urls, the timeout applies on connection and per packet]:TIMEOUT:_default' \
'--padding=[Horizontal padding]:PADDING:_default' \
'--color=[]:COLOR:(never always auto)' \
'--pager=[Modify the default pager]:command:_default' \
'--paging=[]:PAGING:(never always auto)' \
'--img-width=[Image render width (e.g. 80% of terminal, 40c columns, 1920px pixels)]:size:_default' \
'--img-height=[Image render height (e.g. 80% of terminal, 40c rows, 1080px pixels)]:size:_default' \
'--img-zoom=[Image zoom level]:level:_default' \
'--img-x-offset=[X offset from top-left corner in pixels]:pixels:_default' \
'--img-y-offset=[Y offset from top-left corner in pixels]:pixels:_default' \
'--sort=[Sort method]:SORT:(name size time type)' \
'--ls-x-padding=[Cell x padding (e.g. 3c columns, 10% of the terminal, 100px pixels)]:size:_default' \
'--ls-y-padding=[Cell y padding (e.g. 2c rows, 10% of the terminal, 100px pixels)]:size:_default' \
'--ls-min-width=[Minimum cell width (e.g. 2c columns, 10% of the terminal, 100px pixels)]:size:_default' \
'--ls-max-width=[Maximum cell width (e.g. 16c columns, 10% of the terminal, 100px pixels)]:size:_default' \
'--ls-height=[Cell height (e.g. 2c rows, 10% of the terminal, 100px pixels)]:size:_default' \
'--ls-items-per-row=[Maximum items per row]:count:_default' \
'--generate=[Generate shell completions]:shell:(bash elvish fish powershell zsh)' \
'--stdin-piped[]' \
'--testing[]' \
'-i[Shortcut for --output inline]' \
'-I[Shortcut for --output interactive]' \
'--report[Show capabilities and terminal info]' \
'--silent[Remove loading bars]' \
'--no-linenumbers[Disable line numbers in code blocks]' \
'-f[Shortcut for --md-image none]' \
'--force-embed-images[Embed images as base64 in markdown. Images inside archives lack file paths and are normally dropped. This embeds them as data URIs for a complete output, useful when saving markdown for an external renderer. Enabled automatically when rendering images]' \
'--header[Shows YAML headers too]' \
'-c[Force ANSI formatting on]' \
'-C[Force ANSI formatting off]' \
'-p[Force paging on]' \
'-P[Force paging off]' \
'--kitty[Use Kitty image protocol]' \
'--iterm[Use iTerm2 image protocol]' \
'--sixel[Use Sixel image protocol]' \
'--ascii[Use ASCII art output]' \
'--no-center[Disable centering the image in the terminal]' \
'--style-html[Add styling to HTML output]' \
'-a[Include hidden files]' \
'--hidden[Include hidden files]' \
'--hyprlink[Add hyperlinks to file names]' \
'-X[Shortcut for --sort type]' \
'-S[Shortcut for --sort size]' \
'-r[Reverse the order of items]' \
'--reverse[Reverse the order of items]' \
'--fetch-chromium[Download and prepare chromium]' \
'--fetch-ffmpeg[Download and prepare ffmpeg]' \
'--fetch-clean[Clean up local binaries]' \
'-v[Enable verbose debug logging]' \
'--verbose[Enable verbose debug logging]' \
'-h[Print help]' \
'--help[Print help]' \
'-V[Print version]' \
'--version[Print version]' \
'*::input -- Input source (file/dir/url/ls):_default' \
&& ret=0
}

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

if [ "$funcstack[1]" = "_mcat" ]; then
    _mcat "$@"
else
    compdef _mcat mcat
fi
