#compdef btm

autoload -U is-at-least

_btm() {
    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[@]}" : \
'-C+[Sets the location of the config file.]:PATH:_files' \
'--config_location=[Sets the location of the config file.]:PATH:_files' \
'-t+[Default time value for graphs.]:TIME: ' \
'--default_time_value=[Default time value for graphs.]:TIME: ' \
'--default_widget_count=[Sets the N'\''th selected widget type as the default.]:N: ' \
'--default_widget_type=[Sets the default widget type. Use --help for more info.]:WIDGET:(cpu mem net network proc process processes temp temperature disk batt battery)' \
'-r+[Sets how often data is refreshed.]:TIME: ' \
'--rate=[Sets how often data is refreshed.]:TIME: ' \
'--retention=[How far back data will be stored up to.]:TIME: ' \
'-d+[The amount of time changed upon zooming.]:TIME: ' \
'--time_delta=[The amount of time changed upon zooming.]:TIME: ' \
'--default_cpu_entry=[Sets which CPU entry type is selected by default.]:ENTRY:(all avg)' \
'--memory_legend=[Where to place the legend for the memory chart widget.]:POSITION:(none top-left top top-right left right bottom-left bottom bottom-right)' \
'--network_legend=[Where to place the legend for the network chart widget.]:POSITION:(none top-left top top-right left right bottom-left bottom bottom-right)' \
'--theme=[Use a built-in color theme, use '\''--help'\'' for info on the colors. \[possible values\: default, default-light, gruvbox, gruvbox-light, nord, nord-light\]]:SCHEME:(default default-light gruvbox gruvbox-light nord nord-light)' \
'--autohide_time[Temporarily shows the time scale in graphs.]' \
'-b[Hides graphs and uses a more basic look.]' \
'--basic[Hides graphs and uses a more basic look.]' \
'--disable_click[Disables mouse clicks.]' \
'-m[Uses a dot marker for graphs.]' \
'--dot_marker[Uses a dot marker for graphs.]' \
'-e[Expand the default widget upon starting the app.]' \
'--expanded[Expand the default widget upon starting the app.]' \
'--hide_table_gap[Hides spacing between table headers and entries.]' \
'--hide_time[Hides the time scale from being shown.]' \
'--show_table_scroll_position[Shows the list scroll position tracker in the widget title for table widgets.]' \
'-S[Enables case sensitivity by default.]' \
'--case_sensitive[Enables case sensitivity by default.]' \
'-u[Calculates process CPU usage as a percentage of current usage rather than total usage.]' \
'--current_usage[Calculates process CPU usage as a percentage of current usage rather than total usage.]' \
'--disable_advanced_kill[Hides additional stopping options Unix-like systems.]' \
'-g[Groups processes with the same name by default.]' \
'--group_processes[Groups processes with the same name by default.]' \
'--process_memory_as_value[Defaults to showing process memory usage by value.]' \
'--process_command[Shows the full command name instead of the process name by default.]' \
'-R[Enables regex by default while searching.]' \
'--regex[Enables regex by default while searching.]' \
'-T[Makes the process widget use tree mode by default.]' \
'--tree[Makes the process widget use tree mode by default.]' \
'-n[Show process CPU% usage without averaging over the number of CPU cores.]' \
'--unnormalized_cpu[Show process CPU% usage without averaging over the number of CPU cores.]' \
'-W[Enables whole-word matching by default while searching.]' \
'--whole_word[Enables whole-word matching by default while searching.]' \
'-c[Use Celsius as the temperature unit. Default.]' \
'--celsius[Use Celsius as the temperature unit. Default.]' \
'-f[Use Fahrenheit as the temperature unit.]' \
'--fahrenheit[Use Fahrenheit as the temperature unit.]' \
'-k[Use Kelvin as the temperature unit.]' \
'--kelvin[Use Kelvin as the temperature unit.]' \
'-l[Puts the CPU chart legend on the left side.]' \
'--cpu_left_legend[Puts the CPU chart legend on the left side.]' \
'-a[Hides the average CPU usage entry.]' \
'--hide_avg_cpu[Hides the average CPU usage entry.]' \
'--enable_cache_memory[Enables collecting and displaying cache and buffer memory.]' \
'--network_use_bytes[Displays the network widget using bytes.]' \
'--network_use_binary_prefix[Displays the network widget with binary prefixes.]' \
'--network_use_log[Displays the network widget with a log scale.]' \
'--use_old_network_legend[(DEPRECATED) Uses a separate network legend.]' \
'--battery[Shows the battery widget in non-custom layouts.]' \
'--enable_gpu[Enable collecting and displaying GPU usage.]' \
'-h[Prints help info (for more details use '\''--help'\''.]' \
'--help[Prints help info (for more details use '\''--help'\''.]' \
'-V[Prints version information.]' \
'--version[Prints version information.]' \
&& ret=0
}

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

if [ "$funcstack[1]" = "_btm" ]; then
    _btm "$@"
else
    compdef _btm btm
fi
