#compdef laze

autoload -U is-at-least

_laze() {
    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+[change working directory before doing anything else]: :_files -/' \
'--chdir=[change working directory before doing anything else]: :_files -/' \
'-c+[git cache base directory]: :_files -/' \
'--cache-dir=[git cache base directory]: :_files -/' \
'*-v[be verbose (e.g., show command lines)]' \
'*--verbose[be verbose (e.g., show command lines)]' \
'*-q[do not print laze log messages]' \
'*--quiet[do not print laze log messages]' \
'-g[global mode]' \
'--global[global mode]' \
'-h[Print help]' \
'--help[Print help]' \
'-V[Print version]' \
'--version[Print version]' \
":: :_laze_commands" \
"*::: :->laze" \
&& ret=0
    case $state in
    (laze)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:laze-command-$line[1]:"
        case $line[1] in
            (build)
_arguments "${_arguments_options[@]}" : \
'-B+[specify build dir (relative to project root)]:DIR:_files -/' \
'--build-dir=[specify build dir (relative to project root)]:DIR:_files -/' \
'-i+[export build info to file (as JSON)]: :_files' \
'--info-export=[export build info to file (as JSON)]: :_files' \
'-k+[keep going until N jobs / tasks fail (0 means infinity)]: :_default' \
'--keep-going=[keep going until N jobs / tasks fail (0 means infinity)]: :_default' \
'-j+[how many compile jobs to run in parallel]: :_default' \
'--jobs=[how many compile jobs to run in parallel]: :_default' \
'*-b+[builders to configure]: :_default' \
'*--builders=[builders to configure]: :_default' \
'*-a+[apps to configure]: :_default' \
'*--apps=[apps to configure]: :_default' \
'-P+[build only M/N subset (try "count\:1/2")]:PARTITION:_default' \
'--partition=[build only M/N subset (try "count\:1/2")]:PARTITION:_default' \
'*-s+[extra modules to select/enable]: :_default' \
'*--select=[extra modules to select/enable]: :_default' \
'*-d+[disable modules]: :_default' \
'*--disable=[disable modules]: :_default' \
'*-r+[only configure builds using these modules]: :_default' \
'*--requires=[only configure builds using these modules]: :_default' \
'*-D+[set/override variable]: :_default' \
'*--define=[set/override variable]: :_default' \
'-C+[change working directory before doing anything else]: :_files -/' \
'--chdir=[change working directory before doing anything else]: :_files -/' \
'-G[generate build files only, don'\''t start build]' \
'--generate-only[generate build files only, don'\''t start build]' \
'-c[generate compile_commands.json in project root]' \
'--compile-commands[generate compile_commands.json in project root]' \
'-m[if multiple tasks targets are available, execute them all]' \
'--multiple-tasks[if multiple tasks targets are available, execute them all]' \
'*-v[be verbose (e.g., show command lines)]' \
'*--verbose[be verbose (e.g., show command lines)]' \
'*-q[do not print laze log messages]' \
'*--quiet[do not print laze log messages]' \
'-g[global mode]' \
'--global[global mode]' \
'-h[Print help]' \
'--help[Print help]' \
"*::external_command:_default" \
&& ret=0
;;
(clean)
_arguments "${_arguments_options[@]}" : \
'-B+[specify build dir (relative to project root)]:DIR:_files -/' \
'--build-dir=[specify build dir (relative to project root)]:DIR:_files -/' \
'-C+[change working directory before doing anything else]: :_files -/' \
'--chdir=[change working directory before doing anything else]: :_files -/' \
'-u[clean built files that are not produced by the current configuration]' \
'--unused[clean built files that are not produced by the current configuration]' \
'*-v[be verbose (e.g., show command lines)]' \
'*--verbose[be verbose (e.g., show command lines)]' \
'*-q[do not print laze log messages]' \
'*--quiet[do not print laze log messages]' \
'-g[global mode]' \
'--global[global mode]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(new)
_arguments "${_arguments_options[@]}" : \
'-t+[template to use for new project]: :_default' \
'--template=[template to use for new project]: :_default' \
'-C+[change working directory before doing anything else]: :_files -/' \
'--chdir=[change working directory before doing anything else]: :_files -/' \
'*-v[be verbose (e.g., show command lines)]' \
'*--verbose[be verbose (e.g., show command lines)]' \
'*-q[do not print laze log messages]' \
'*--quiet[do not print laze log messages]' \
'-g[global mode]' \
'--global[global mode]' \
'-h[Print help]' \
'--help[Print help]' \
':path -- directory for new project:_files -/' \
&& ret=0
;;
(completion)
_arguments "${_arguments_options[@]}" : \
'--generate=[shell to generate completions for]: :(bash elvish fish powershell zsh)' \
'-C+[change working directory before doing anything else]: :_files -/' \
'--chdir=[change working directory before doing anything else]: :_files -/' \
'*-v[be verbose (e.g., show command lines)]' \
'*--verbose[be verbose (e.g., show command lines)]' \
'*-q[do not print laze log messages]' \
'*--quiet[do not print laze log messages]' \
'-g[global mode]' \
'--global[global mode]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(manpages)
_arguments "${_arguments_options[@]}" : \
'-C+[change working directory before doing anything else]: :_files -/' \
'--chdir=[change working directory before doing anything else]: :_files -/' \
'*-v[be verbose (e.g., show command lines)]' \
'*--verbose[be verbose (e.g., show command lines)]' \
'*-q[do not print laze log messages]' \
'*--quiet[do not print laze log messages]' \
'-g[global mode]' \
'--global[global mode]' \
'-h[Print help]' \
'--help[Print help]' \
':outdir -- directory in which to create manpage files:_files -/' \
&& ret=0
;;
(git-clone)
_arguments "${_arguments_options[@]}" : \
'(-b --branch)--commit=[check out specific commit]:HASH:_default' \
'(-b --branch)*--sparse-add=[do a sparse checkout, keep PATH]:PATH:_default' \
'*--recurse-submodules=[recursively clone submodules]::pathspec:_default' \
'-j+[The number of submodules fetched at the same time.]: :_default' \
'--jobs=[The number of submodules fetched at the same time.]: :_default' \
'-b+[]: :_default' \
'--branch=[]: :_default' \
'-c+[]: :_default' \
'--config=[]: :_default' \
'-o+[]: :_default' \
'--origin=[]: :_default' \
'-u+[]: :_default' \
'--upload-pack=[]: :_default' \
'--bundle-uri=[]: :_default' \
'--depth=[]: :_default' \
'--filter=[]: :_default' \
'--reference=[]: :_default' \
'--reference-if-able=[]: :_default' \
'--separate-git-dir=[]: :_default' \
'--shallow-exclude=[]: :_default' \
'--shallow-since=[]: :_default' \
'--template=[]: :_default' \
'-C+[change working directory before doing anything else]: :_files -/' \
'--chdir=[change working directory before doing anything else]: :_files -/' \
'-U[force update of cached repo]' \
'--update[force update of cached repo]' \
'--shallow-submodules[shallow-clone submodules]' \
'--no-shallow-submodules[don'\''t shallow-clone submodules]' \
'-l[]' \
'--local[]' \
'-q[]' \
'--quiet[]' \
'-s[]' \
'--shared[]' \
'-v[]' \
'--verbose[]' \
'-n[]' \
'--no-checkout[]' \
'--sparse[]' \
'--also-filter-submodules[]' \
'--bare[]' \
'--dissociate[]' \
'--mirror[]' \
'--no-hardlinks[]' \
'--no-reject-shallow[]' \
'--no-remote-submodules[]' \
'--no-single-branch[]' \
'--no-tags[]' \
'--reject-shallow[]' \
'--remote-submodules[]' \
'--single-branch[]' \
'-g[global mode]' \
'--global[global mode]' \
'-h[Print help]' \
'--help[Print help]' \
':repository -- repository to clone:_default' \
'::target_path -- target path:_files -/' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
":: :_laze__help_commands" \
"*::: :->help" \
&& ret=0

    case $state in
    (help)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:laze-help-command-$line[1]:"
        case $line[1] in
            (build)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(clean)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(new)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(completion)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(manpages)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(git-clone)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
        esac
    ;;
esac
}

(( $+functions[_laze_commands] )) ||
_laze_commands() {
    local commands; commands=(
'build:generate build files and build' \
'clean:clean current configuration' \
'new:Create a new laze project at <PATH>' \
'completion:Generate laze shell completions.' \
'manpages:Generate laze manpages.' \
'git-clone:clone repository' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'laze commands' commands "$@"
}
(( $+functions[_laze__build_commands] )) ||
_laze__build_commands() {
    local commands; commands=()
    _describe -t commands 'laze build commands' commands "$@"
}
(( $+functions[_laze__clean_commands] )) ||
_laze__clean_commands() {
    local commands; commands=()
    _describe -t commands 'laze clean commands' commands "$@"
}
(( $+functions[_laze__completion_commands] )) ||
_laze__completion_commands() {
    local commands; commands=()
    _describe -t commands 'laze completion commands' commands "$@"
}
(( $+functions[_laze__git-clone_commands] )) ||
_laze__git-clone_commands() {
    local commands; commands=()
    _describe -t commands 'laze git-clone commands' commands "$@"
}
(( $+functions[_laze__help_commands] )) ||
_laze__help_commands() {
    local commands; commands=(
'build:generate build files and build' \
'clean:clean current configuration' \
'new:Create a new laze project at <PATH>' \
'completion:Generate laze shell completions.' \
'manpages:Generate laze manpages.' \
'git-clone:clone repository' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'laze help commands' commands "$@"
}
(( $+functions[_laze__help__build_commands] )) ||
_laze__help__build_commands() {
    local commands; commands=()
    _describe -t commands 'laze help build commands' commands "$@"
}
(( $+functions[_laze__help__clean_commands] )) ||
_laze__help__clean_commands() {
    local commands; commands=()
    _describe -t commands 'laze help clean commands' commands "$@"
}
(( $+functions[_laze__help__completion_commands] )) ||
_laze__help__completion_commands() {
    local commands; commands=()
    _describe -t commands 'laze help completion commands' commands "$@"
}
(( $+functions[_laze__help__git-clone_commands] )) ||
_laze__help__git-clone_commands() {
    local commands; commands=()
    _describe -t commands 'laze help git-clone commands' commands "$@"
}
(( $+functions[_laze__help__help_commands] )) ||
_laze__help__help_commands() {
    local commands; commands=()
    _describe -t commands 'laze help help commands' commands "$@"
}
(( $+functions[_laze__help__manpages_commands] )) ||
_laze__help__manpages_commands() {
    local commands; commands=()
    _describe -t commands 'laze help manpages commands' commands "$@"
}
(( $+functions[_laze__help__new_commands] )) ||
_laze__help__new_commands() {
    local commands; commands=()
    _describe -t commands 'laze help new commands' commands "$@"
}
(( $+functions[_laze__manpages_commands] )) ||
_laze__manpages_commands() {
    local commands; commands=()
    _describe -t commands 'laze manpages commands' commands "$@"
}
(( $+functions[_laze__new_commands] )) ||
_laze__new_commands() {
    local commands; commands=()
    _describe -t commands 'laze new commands' commands "$@"
}

if [ "$funcstack[1]" = "_laze" ]; then
    _laze "$@"
else
    compdef _laze laze
fi
