#compdef youki

autoload -U is-at-least

_youki() {
    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[@]}" : \
'-l+[set the log file to write youki logs to (default is '\''/dev/stderr'\'')]:LOG:_files' \
'--log=[set the log file to write youki logs to (default is '\''/dev/stderr'\'')]:LOG:_files' \
'--log-format=[set the log format ('\''text'\'' (default), or '\''json'\'') (default\: "text")]:LOG_FORMAT: ' \
'-r+[root directory to store container state]:ROOT:_files' \
'--root=[root directory to store container state]:ROOT:_files' \
'--log-level=[set the log level (default is '\''error'\'')]:LOG_LEVEL: ' \
'--debug[change log level to debug, but the \`log-level\` flag takes precedence]' \
'-s[Enable systemd cgroup manager, rather then use the cgroupfs directly]' \
'--systemd-cgroup[Enable systemd cgroup manager, rather then use the cgroupfs directly]' \
'--systemd-log[Enable logging to systemd-journald]' \
'-v[Display youki version and commit hash]' \
'--version[Display youki version and commit hash]' \
'-h[Print help]' \
'--help[Print help]' \
":: :_youki_commands" \
"*::: :->youki" \
&& ret=0
    case $state in
    (youki)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:youki-command-$line[1]:"
        case $line[1] in
            (create)
_arguments "${_arguments_options[@]}" : \
'-b+[Path to the bundle directory, containing config.json and root filesystem]:BUNDLE:_files' \
'--bundle=[Path to the bundle directory, containing config.json and root filesystem]:BUNDLE:_files' \
'-c+[Unix socket (file) path , which will receive file descriptor of the writing end of the pseudoterminal]:CONSOLE_SOCKET:_files' \
'--console-socket=[Unix socket (file) path , which will receive file descriptor of the writing end of the pseudoterminal]:CONSOLE_SOCKET:_files' \
'-p+[File to write pid of the container created]:PID_FILE:_files' \
'--pid-file=[File to write pid of the container created]:PID_FILE:_files' \
'--preserve-fds=[Pass N additional file descriptors to the container (stdio + \$LISTEN_FDS + N in total)]:PRESERVE_FDS: ' \
'--no-pivot[Do not use pivot rool to jail process inside rootfs]' \
'--no-new-keyring[Do not create a new session keyring for the container]' \
'-h[Print help]' \
'--help[Print help]' \
':container_id -- Name of the container instance to be started:' \
&& ret=0
;;
(start)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
':container_id:' \
&& ret=0
;;
(state)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
':container_id:' \
&& ret=0
;;
(kill)
_arguments "${_arguments_options[@]}" : \
'-a[]' \
'--all[]' \
'-h[Print help]' \
'--help[Print help]' \
':container_id:' \
':signal:' \
&& ret=0
;;
(delete)
_arguments "${_arguments_options[@]}" : \
'-f[forces deletion of the container if it is still running (using SIGKILL)]' \
'--force[forces deletion of the container if it is still running (using SIGKILL)]' \
'-h[Print help]' \
'--help[Print help]' \
':container_id:' \
&& ret=0
;;
(checkpointt)
_arguments "${_arguments_options[@]}" : \
'--image-path=[Path for saving criu image files]:IMAGE_PATH:_files' \
'--work-path=[Path for saving work files and logs]:WORK_PATH:_files' \
'--parent-path=[Path for previous criu image file in pre-dump]:PARENT_PATH:_files' \
'--status-fd=[Pass a file descriptor fd to criu]:STATUS_FD: ' \
'--page-server=[Start a page server at the given URL]:PAGE_SERVER: ' \
'--manage-cgroups-mode=[Cgroups mode]:MANAGE_CGROUPS_MODE: ' \
'--leave-running[Leave the process running after checkpointing]' \
'--tcp-established[Allow open tcp connections]' \
'--ext-unix-sk[Allow external unix sockets]' \
'--shell-job[Allow shell jobs]' \
'--lazy-pages[Use lazy migration mechanism]' \
'--file-locks[Allow file locks]' \
'--pre-dump[Do a pre-dump]' \
'--empty-ns[Checkpoint a namespace, but don'\''t save its properties]' \
'--auto-dedup[Enable auto-deduplication]' \
'-h[Print help]' \
'--help[Print help]' \
':container_id:' \
&& ret=0
;;
(events)
_arguments "${_arguments_options[@]}" : \
'--interval=[Sets the stats collection interval in seconds (default\: 5s)]:INTERVAL: ' \
'--stats[Display the container stats only once]' \
'-h[Print help]' \
'--help[Print help]' \
':container_id -- Name of the container instance:' \
&& ret=0
;;
(exec)
_arguments "${_arguments_options[@]}" : \
'--console-socket=[Unix socket (file) path , which will receive file descriptor of the writing end of the pseudoterminal]:CONSOLE_SOCKET:_files' \
'--cwd=[Current working directory of the container]:CWD:_files' \
'*-e+[Environment variables that should be set in the container]:ENV: ' \
'*--env=[Environment variables that should be set in the container]:ENV: ' \
'-u+[Run the command as a user]:USER: ' \
'--user=[Run the command as a user]:USER: ' \
'*-g+[Add additional group IDs. Can be specified multiple times]:ADDITIONAL_GIDS: ' \
'*--additional-gids=[Add additional group IDs. Can be specified multiple times]:ADDITIONAL_GIDS: ' \
'-p+[Path to process.json]:PROCESS:_files' \
'--process=[Path to process.json]:PROCESS:_files' \
'--pid-file=[The file to which the pid of the container process should be written to]:PID_FILE:_files' \
'--process-label=[Set the asm process label for the process commonly used with selinux]:PROCESS_LABEL: ' \
'--apparmor=[Set the apparmor profile for the process]:APPARMOR: ' \
'*--cap=[Add a capability to the bounding set for the process]:CAP: ' \
'--preserve-fds=[Pass N additional file descriptors to the container]:PRESERVE_FDS: ' \
'--cgroup=[Execute a process in a sub-cgroup]:CGROUP: ' \
'-t[]' \
'--tty[]' \
'-d[Detach from the container process]' \
'--detach[Detach from the container process]' \
'--no-new-privs[Prevent the process from gaining additional privileges]' \
'--ignore-paused[Allow exec in a paused container]' \
'-h[Print help]' \
'--help[Print help]' \
':container_id -- Identifier of the container:' \
'*::command -- Command that should be executed in the container:' \
&& ret=0
;;
(features)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(list)
_arguments "${_arguments_options[@]}" : \
'--format=[Specify the format (default or table)]:FORMAT: ' \
'-q[Only display container IDs]' \
'--quiet[Only display container IDs]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(pause)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
':container_id:' \
&& ret=0
;;
(ps)
_arguments "${_arguments_options[@]}" : \
'-f+[format to display processes\: table or json (default\: "table")]:FORMAT: ' \
'--format=[format to display processes\: table or json (default\: "table")]:FORMAT: ' \
'-h[Print help]' \
'--help[Print help]' \
':container_id:' \
'*::ps_options -- options will be passed to the ps utility:' \
&& ret=0
;;
(resume)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
':container_id:' \
&& ret=0
;;
(run)
_arguments "${_arguments_options[@]}" : \
'-b+[Path to the bundle directory, containing config.json and root filesystem]:BUNDLE:_files' \
'--bundle=[Path to the bundle directory, containing config.json and root filesystem]:BUNDLE:_files' \
'-c+[Unix socket (file) path , which will receive file descriptor of the writing end of the pseudoterminal]:CONSOLE_SOCKET:_files' \
'--console-socket=[Unix socket (file) path , which will receive file descriptor of the writing end of the pseudoterminal]:CONSOLE_SOCKET:_files' \
'-p+[File to write pid of the container created]:PID_FILE:_files' \
'--pid-file=[File to write pid of the container created]:PID_FILE:_files' \
'--preserve-fds=[Pass N additional file descriptors to the container (stdio + \$LISTEN_FDS + N in total)]:PRESERVE_FDS: ' \
'--no-subreaper[Disable the use of the subreaper used to reap reparented processes]' \
'--no-pivot[Do not use pivot root to jail process inside rootfs]' \
'--no-new-keyring[Do not create a new session keyring for the container. This will cause the container to inherit the calling processes session key]' \
'--keep[]' \
'-d[Detach from the container process]' \
'--detach[Detach from the container process]' \
'-h[Print help]' \
'--help[Print help]' \
':container_id -- name of the container instance to be started:' \
&& ret=0
;;
(update)
_arguments "${_arguments_options[@]}" : \
'-r+[Read the new resource limits from the given json file. Use - to read from stdin. If this option is used, all other options are ignored]:RESOURCES:_files' \
'--resources=[Read the new resource limits from the given json file. Use - to read from stdin. If this option is used, all other options are ignored]:RESOURCES:_files' \
'--blkio-weight=[Set a new I/O weight]:BLKIO_WEIGHT: ' \
'--cpu-period=[Set CPU CFS period to be used for hardcapping (in microseconds)]:CPU_PERIOD: ' \
'--cpu-quota=[Set CPU usage limit within a given period (in microseconds)]:CPU_QUOTA: ' \
'--cpu-rt-period=[Set CPU realtime period to be used for hardcapping (in microseconds)]:CPU_RT_PERIOD: ' \
'--cpu-rt-runtime=[Set CPU realtime hardcap limit (in microseconds)]:CPU_RT_RUNTIME: ' \
'--cpu-share=[Set CPU shares (relative weight vs. other containers)]:CPU_SHARE: ' \
'--cpuset-cpus=[Set CPU(s) to use. The list can contain commas and ranges. For example\: 0-3,7]:CPUSET_CPUS: ' \
'--cpuset-mems=[Set memory node(s) to use. The list format is the same as for --cpuset-cpus]:CPUSET_MEMS: ' \
'--memory=[Set memory limit to num bytes]:MEMORY: ' \
'--memory-reservation=[Set memory reservation (or soft limit) to num bytes]:MEMORY_RESERVATION: ' \
'--memory-swap=[Set total memory + swap usage to num bytes. Use -1 to unset the limit (i.e. use unlimited swap)]:MEMORY_SWAP: ' \
'--pids-limit=[Set the maximum number of processes allowed in the container]:PIDS_LIMIT: ' \
'--l3-cache-schema=[Set the value for Intel RDT/CAT L3 cache schema]:L3_CACHE_SCHEMA: ' \
'--mem-bw-schema=[Set the Intel RDT/MBA memory bandwidth schema]:MEM_BW_SCHEMA: ' \
'-h[Print help]' \
'--help[Print help]' \
':container_id:' \
&& ret=0
;;
(spec)
_arguments "${_arguments_options[@]}" : \
'-b+[Set path to the root of the bundle directory]:BUNDLE:_files' \
'--bundle=[Set path to the root of the bundle directory]:BUNDLE:_files' \
'--rootless[Generate a configuration for a rootless container]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(info)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(completion)
_arguments "${_arguments_options[@]}" : \
'-s+[]:SHELL:(bash elvish fish powershell zsh)' \
'--shell=[]:SHELL:(bash elvish fish powershell zsh)' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
":: :_youki__help_commands" \
"*::: :->help" \
&& ret=0

    case $state in
    (help)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:youki-help-command-$line[1]:"
        case $line[1] in
            (create)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(start)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(state)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(kill)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(delete)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(checkpointt)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(events)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(exec)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(features)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(list)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(pause)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(ps)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(resume)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(run)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(update)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(spec)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(info)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(completion)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
        esac
    ;;
esac
}

(( $+functions[_youki_commands] )) ||
_youki_commands() {
    local commands; commands=(
'create:Create a container Reference\: https\://github.com/opencontainers/runc/blob/main/man/runc-create.8.md' \
'start:Start a previously created container' \
'state:Show the container state' \
'kill:Send the specified signal to the container' \
'delete:Release any resources held by the container' \
'checkpointt:Checkpoint a running container Reference\: https\://github.com/opencontainers/runc/blob/main/man/runc-checkpoint.8.md' \
'events:Show resource statistics for the container' \
'exec:Execute a process within an existing container Reference\: https\://github.com/opencontainers/runc/blob/main/man/runc-exec.8.md' \
'features:Return the features list for a container This subcommand was introduced in runc by https\://github.com/opencontainers/runc/pull/3296 It is documented here\: https\://github.com/opencontainers/runtime-spec/blob/main/features-linux.md' \
'list:List created containers' \
'pause:Suspend the processes within the container' \
'ps:Display the processes inside the container' \
'resume:Resume the processes within the container' \
'run:Create a container and immediately start it' \
'update:Update running container resource constraints' \
'spec:Command generates a config.json' \
'info:Show information about the system' \
'completion:Generate scripts for shell completion' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'youki commands' commands "$@"
}
(( $+functions[_youki__checkpointt_commands] )) ||
_youki__checkpointt_commands() {
    local commands; commands=()
    _describe -t commands 'youki checkpointt commands' commands "$@"
}
(( $+functions[_youki__completion_commands] )) ||
_youki__completion_commands() {
    local commands; commands=()
    _describe -t commands 'youki completion commands' commands "$@"
}
(( $+functions[_youki__create_commands] )) ||
_youki__create_commands() {
    local commands; commands=()
    _describe -t commands 'youki create commands' commands "$@"
}
(( $+functions[_youki__delete_commands] )) ||
_youki__delete_commands() {
    local commands; commands=()
    _describe -t commands 'youki delete commands' commands "$@"
}
(( $+functions[_youki__events_commands] )) ||
_youki__events_commands() {
    local commands; commands=()
    _describe -t commands 'youki events commands' commands "$@"
}
(( $+functions[_youki__exec_commands] )) ||
_youki__exec_commands() {
    local commands; commands=()
    _describe -t commands 'youki exec commands' commands "$@"
}
(( $+functions[_youki__features_commands] )) ||
_youki__features_commands() {
    local commands; commands=()
    _describe -t commands 'youki features commands' commands "$@"
}
(( $+functions[_youki__help_commands] )) ||
_youki__help_commands() {
    local commands; commands=(
'create:Create a container Reference\: https\://github.com/opencontainers/runc/blob/main/man/runc-create.8.md' \
'start:Start a previously created container' \
'state:Show the container state' \
'kill:Send the specified signal to the container' \
'delete:Release any resources held by the container' \
'checkpointt:Checkpoint a running container Reference\: https\://github.com/opencontainers/runc/blob/main/man/runc-checkpoint.8.md' \
'events:Show resource statistics for the container' \
'exec:Execute a process within an existing container Reference\: https\://github.com/opencontainers/runc/blob/main/man/runc-exec.8.md' \
'features:Return the features list for a container This subcommand was introduced in runc by https\://github.com/opencontainers/runc/pull/3296 It is documented here\: https\://github.com/opencontainers/runtime-spec/blob/main/features-linux.md' \
'list:List created containers' \
'pause:Suspend the processes within the container' \
'ps:Display the processes inside the container' \
'resume:Resume the processes within the container' \
'run:Create a container and immediately start it' \
'update:Update running container resource constraints' \
'spec:Command generates a config.json' \
'info:Show information about the system' \
'completion:Generate scripts for shell completion' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'youki help commands' commands "$@"
}
(( $+functions[_youki__help__checkpointt_commands] )) ||
_youki__help__checkpointt_commands() {
    local commands; commands=()
    _describe -t commands 'youki help checkpointt commands' commands "$@"
}
(( $+functions[_youki__help__completion_commands] )) ||
_youki__help__completion_commands() {
    local commands; commands=()
    _describe -t commands 'youki help completion commands' commands "$@"
}
(( $+functions[_youki__help__create_commands] )) ||
_youki__help__create_commands() {
    local commands; commands=()
    _describe -t commands 'youki help create commands' commands "$@"
}
(( $+functions[_youki__help__delete_commands] )) ||
_youki__help__delete_commands() {
    local commands; commands=()
    _describe -t commands 'youki help delete commands' commands "$@"
}
(( $+functions[_youki__help__events_commands] )) ||
_youki__help__events_commands() {
    local commands; commands=()
    _describe -t commands 'youki help events commands' commands "$@"
}
(( $+functions[_youki__help__exec_commands] )) ||
_youki__help__exec_commands() {
    local commands; commands=()
    _describe -t commands 'youki help exec commands' commands "$@"
}
(( $+functions[_youki__help__features_commands] )) ||
_youki__help__features_commands() {
    local commands; commands=()
    _describe -t commands 'youki help features commands' commands "$@"
}
(( $+functions[_youki__help__help_commands] )) ||
_youki__help__help_commands() {
    local commands; commands=()
    _describe -t commands 'youki help help commands' commands "$@"
}
(( $+functions[_youki__help__info_commands] )) ||
_youki__help__info_commands() {
    local commands; commands=()
    _describe -t commands 'youki help info commands' commands "$@"
}
(( $+functions[_youki__help__kill_commands] )) ||
_youki__help__kill_commands() {
    local commands; commands=()
    _describe -t commands 'youki help kill commands' commands "$@"
}
(( $+functions[_youki__help__list_commands] )) ||
_youki__help__list_commands() {
    local commands; commands=()
    _describe -t commands 'youki help list commands' commands "$@"
}
(( $+functions[_youki__help__pause_commands] )) ||
_youki__help__pause_commands() {
    local commands; commands=()
    _describe -t commands 'youki help pause commands' commands "$@"
}
(( $+functions[_youki__help__ps_commands] )) ||
_youki__help__ps_commands() {
    local commands; commands=()
    _describe -t commands 'youki help ps commands' commands "$@"
}
(( $+functions[_youki__help__resume_commands] )) ||
_youki__help__resume_commands() {
    local commands; commands=()
    _describe -t commands 'youki help resume commands' commands "$@"
}
(( $+functions[_youki__help__run_commands] )) ||
_youki__help__run_commands() {
    local commands; commands=()
    _describe -t commands 'youki help run commands' commands "$@"
}
(( $+functions[_youki__help__spec_commands] )) ||
_youki__help__spec_commands() {
    local commands; commands=()
    _describe -t commands 'youki help spec commands' commands "$@"
}
(( $+functions[_youki__help__start_commands] )) ||
_youki__help__start_commands() {
    local commands; commands=()
    _describe -t commands 'youki help start commands' commands "$@"
}
(( $+functions[_youki__help__state_commands] )) ||
_youki__help__state_commands() {
    local commands; commands=()
    _describe -t commands 'youki help state commands' commands "$@"
}
(( $+functions[_youki__help__update_commands] )) ||
_youki__help__update_commands() {
    local commands; commands=()
    _describe -t commands 'youki help update commands' commands "$@"
}
(( $+functions[_youki__info_commands] )) ||
_youki__info_commands() {
    local commands; commands=()
    _describe -t commands 'youki info commands' commands "$@"
}
(( $+functions[_youki__kill_commands] )) ||
_youki__kill_commands() {
    local commands; commands=()
    _describe -t commands 'youki kill commands' commands "$@"
}
(( $+functions[_youki__list_commands] )) ||
_youki__list_commands() {
    local commands; commands=()
    _describe -t commands 'youki list commands' commands "$@"
}
(( $+functions[_youki__pause_commands] )) ||
_youki__pause_commands() {
    local commands; commands=()
    _describe -t commands 'youki pause commands' commands "$@"
}
(( $+functions[_youki__ps_commands] )) ||
_youki__ps_commands() {
    local commands; commands=()
    _describe -t commands 'youki ps commands' commands "$@"
}
(( $+functions[_youki__resume_commands] )) ||
_youki__resume_commands() {
    local commands; commands=()
    _describe -t commands 'youki resume commands' commands "$@"
}
(( $+functions[_youki__run_commands] )) ||
_youki__run_commands() {
    local commands; commands=()
    _describe -t commands 'youki run commands' commands "$@"
}
(( $+functions[_youki__spec_commands] )) ||
_youki__spec_commands() {
    local commands; commands=()
    _describe -t commands 'youki spec commands' commands "$@"
}
(( $+functions[_youki__start_commands] )) ||
_youki__start_commands() {
    local commands; commands=()
    _describe -t commands 'youki start commands' commands "$@"
}
(( $+functions[_youki__state_commands] )) ||
_youki__state_commands() {
    local commands; commands=()
    _describe -t commands 'youki state commands' commands "$@"
}
(( $+functions[_youki__update_commands] )) ||
_youki__update_commands() {
    local commands; commands=()
    _describe -t commands 'youki update commands' commands "$@"
}

if [ "$funcstack[1]" = "_youki" ]; then
    _youki "$@"
else
    compdef _youki youki
fi
