1#compdef oomctl
2# SPDX-License-Identifier: LGPL-2.1-or-later
3
4(( $+functions[_oomctl_commands] )) || _oomctl_commands()
5{
6    local -a _oomctl_cmds
7    _oomctl_cmds=(
8        "dump:Show the current state of the cgroup(s) and system context(s)"
9        "help:Prints a short help text and exits."
10    )
11    if (( CURRENT == 1 )); then
12        _describe -t commands 'oomctl command' _oomctl_cmds
13    else
14        local curcontext="$curcontext"
15        cmd="${${_oomctl_cmds[(r)$words[1]:*]%%:*}}"
16        if (( $+functions[_oomctl_$cmd] )); then
17            _oomctl_$cmd
18        else
19            _message "no more options"
20        fi
21    fi
22}
23
24_arguments \
25    {-h,--help}'[Prints a short help text and exits.]' \
26    '--version[Prints a short version string and exits.]' \
27    '--no-pager[Do not pipe output into a pager]' \
28    '*::oomctl command:_oomctl_commands'
29