#compdef garden

autoload -U is-at-least

_garden() {
    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[@]}" : \
'--color=[Use ANSI colors \[auto, true, false, on, off, always, never, 1, 0\]]::WHEN:_default' \
'-c+[Set the Garden file to use]:CONFIG:_files' \
'--config=[Set the Garden file to use]:CONFIG:_files' \
'-C+[Change directories before searching for Garden files]:CHDIR:_files -/' \
'--chdir=[Change directories before searching for Garden files]:CHDIR:_files -/' \
'*-d+[Increase verbosity for a debug category]:DEBUG:_default' \
'*--debug=[Increase verbosity for a debug category]:DEBUG:_default' \
'*-D+[Set variables using '\''name=value'\'' expressions]:DEFINE:_default' \
'*--define=[Set variables using '\''name=value'\'' expressions]:DEFINE:_default' \
'-r+[Set the Garden tree root]:ROOT:_files -/' \
'--root=[Set the Garden tree root]:ROOT:_files -/' \
'-q[Be quiet]' \
'--quiet[Be quiet]' \
'*-v[Increase verbosity level (default\: 0)]' \
'*--verbose[Increase verbosity level (default\: 0)]' \
'-h[Print help]' \
'--help[Print help]' \
'-V[Print version]' \
'--version[Print version]' \
":: :_garden_commands" \
"*::: :->garden" \
&& ret=0
    case $state in
    (garden)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:garden-command-$line[1]:"
        case $line[1] in
            (cmd)
_arguments "${_arguments_options[@]}" : \
'-t+[Filter trees by name post-query using a glob pattern]:TREES:_default' \
'--trees=[Filter trees by name post-query using a glob pattern]:TREES:_default' \
'*-D+[Set variables using '\''name=value'\'' expressions]:DEFINE:_default' \
'*--define=[Set variables using '\''name=value'\'' expressions]:DEFINE:_default' \
'-j+[Run commands in parallel using the specified number of jobs]::JOBS:_default' \
'--jobs=[Run commands in parallel using the specified number of jobs]::JOBS:_default' \
'-b[Run a command in all trees before running the next command]' \
'--breadth-first[Run a command in all trees before running the next command]' \
'-N[Perform a trial run without running commands]' \
'--dry-run[Perform a trial run without running commands]' \
'-k[Continue to the next tree when errors occur]' \
'--keep-going[Continue to the next tree when errors occur]' \
'-n[Do not pass "-e" to the shell. Prevent the "errexit" shell option from being set. By default, the "-e" option is passed to the configured shell so that multi-line and multi-statement commands halt execution when the first statement with a non-zero exit code is encountered. This option has the effect of making multi-line and multi-statement commands run all statements even when an earlier statement returns a non-zero exit code]' \
'--no-errexit[Do not pass "-e" to the shell. Prevent the "errexit" shell option from being set. By default, the "-e" option is passed to the configured shell so that multi-line and multi-statement commands halt execution when the first statement with a non-zero exit code is encountered. This option has the effect of making multi-line and multi-statement commands run all statements even when an earlier statement returns a non-zero exit code]' \
'-f[Run commands even when the tree does not exist]' \
'--force[Run commands even when the tree does not exist]' \
'-q[Be quiet]' \
'--quiet[Be quiet]' \
'*-v[Increase verbosity level (default\: 0)]' \
'*--verbose[Increase verbosity level (default\: 0)]' \
'-x[Enable echo mode by passing "-x" to the shell]' \
'--echo[Enable echo mode by passing "-x" to the shell]' \
'-z[Do not pass "-o shwordsplit" to zsh. Prevent the "shwordsplit" shell option from being set when using zsh. The "-o shwordsplit" option is passed to zsh by default so that unquoted \$variable expressions are subject to word splitting, just like other shells. This option disables this behavior]' \
'--no-wordsplit[Do not pass "-o shwordsplit" to zsh. Prevent the "shwordsplit" shell option from being set when using zsh. The "-o shwordsplit" option is passed to zsh by default so that unquoted \$variable expressions are subject to word splitting, just like other shells. This option disables this behavior]' \
'-h[Print help]' \
'--help[Print help]' \
':query -- Tree query for the gardens, groups or trees to execute commands within:_default' \
'*--::commands -- Custom commands to run over the resolved trees:_default' \
'*::arguments -- Arguments to forward to custom commands:_default' \
&& ret=0
;;
(completion)
_arguments "${_arguments_options[@]}" : \
'-c[Include completions for custom commands]' \
'--commands[Include completions for custom commands]' \
'-h[Print help]' \
'--help[Print help]' \
'::shell -- Shell syntax to emit:(bash elvish fish powershell zsh)' \
&& ret=0
;;
(eval)
_arguments "${_arguments_options[@]}" : \
'*-D+[Set variables using '\''name=value'\'' expressions]:DEFINE:_default' \
'*--define=[Set variables using '\''name=value'\'' expressions]:DEFINE:_default' \
'-h[Print help]' \
'--help[Print help]' \
':expr -- Expression to evaluate:_default' \
'::tree -- Tree within which to evaluate:_default' \
'::garden -- Garden within which to evaluate:_default' \
&& ret=0
;;
(exec)
_arguments "${_arguments_options[@]}" : \
'-t+[Filter trees by name post-query using a glob pattern]:TREES:_default' \
'--trees=[Filter trees by name post-query using a glob pattern]:TREES:_default' \
'-j+[Run commands in parallel using the specified number of jobs]:JOBS:_default' \
'--jobs=[Run commands in parallel using the specified number of jobs]:JOBS:_default' \
'-N[Perform a trial run without executing any commands]' \
'--dry-run[Perform a trial run without executing any commands]' \
'-q[Be quiet]' \
'--quiet[Be quiet]' \
'*-v[Increase verbosity level (default\: 0)]' \
'*--verbose[Increase verbosity level (default\: 0)]' \
'-h[Print help]' \
'--help[Print help]' \
':query -- Tree query for the gardens, groups or trees to run the command:' \
'*::command -- Command to run in the resolved environments:_cmdambivalent' \
&& ret=0
;;
(git)
_arguments "${_arguments_options[@]}" : \
'-t+[Filter trees by name post-query using a glob pattern]:TREES:_default' \
'--trees=[Filter trees by name post-query using a glob pattern]:TREES:_default' \
'-j+[Run commands in parallel using the specified number of jobs]:JOBS:_default' \
'--jobs=[Run commands in parallel using the specified number of jobs]:JOBS:_default' \
'-N[Perform a trial run without executing any commands]' \
'--dry-run[Perform a trial run without executing any commands]' \
'-q[Be quiet]' \
'--quiet[Be quiet]' \
'*-v[Increase verbosity level (default\: 0)]' \
'*--verbose[Increase verbosity level (default\: 0)]' \
'-h[Print help]' \
'--help[Print help]' \
'::query -- Tree query for the gardens, groups or trees to run the command:' \
'*::command -- Git command to run in the resolved environments:_default' \
&& ret=0
;;
(grow)
_arguments "${_arguments_options[@]}" : \
'-t+[Filter trees by name post-query using a glob pattern]:TREES:_default' \
'--trees=[Filter trees by name post-query using a glob pattern]:TREES:_default' \
'--remote=[Filter remotes by name using a glob pattern]:REMOTE:_default' \
'*-v[Increase verbosity level (default\: 0)]' \
'*--verbose[Increase verbosity level (default\: 0)]' \
'-h[Print help]' \
'--help[Print help]' \
'*::queries -- Tree query for the gardens, groups or trees to grow:_default' \
&& ret=0
;;
(gui)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
'*::args:_default' \
&& ret=0
;;
(init)
_arguments "${_arguments_options[@]}" : \
'--root=[Set the garden root path]:ROOT:_files -/' \
'--empty[Do not add any trees when initializing]' \
'-f[Overwrite existing config files]' \
'--force[Overwrite existing config files]' \
'--global[Use the user-wide configuration directory (~/.config/garden/garden.yaml)]' \
'-h[Print help]' \
'--help[Print help]' \
'::filename -- Config filename to write:_files' \
&& ret=0
;;
(ls)
_arguments "${_arguments_options[@]}" : \
'-s+[Sort trees using the specified mode \[none, name, time\]]::MODE:_default' \
'--sort=[Sort trees using the specified mode \[none, name, time\]]::MODE:_default' \
'-t+[Filter trees by name post-query using a glob pattern]:TREES:_default' \
'--trees=[Filter trees by name post-query using a glob pattern]:TREES:_default' \
'-a[Display details for all trees, including missing trees]' \
'--all[Display details for all trees, including missing trees]' \
'-C[Do not show commands]' \
'--no-commands[Do not show commands]' \
'*-c[Display commands. Omits descriptions, remotes and links so that commands are more visible]' \
'*--commands[Display commands. Omits descriptions, remotes and links so that commands are more visible]' \
'-N[Do not show gardens]' \
'--no-gardens[Do not show gardens]' \
'-G[Do not show groups]' \
'--no-groups[Do not show groups]' \
'-R[Do not show remotes]' \
'--no-remotes[Do not show remotes]' \
'-r[Print trees in reverse order]' \
'--reverse[Print trees in reverse order]' \
'*-v[Increase verbosity level (default\: 0)]' \
'*--verbose[Increase verbosity level (default\: 0)]' \
'-w[Display worktrees]' \
'--worktrees[Display worktrees]' \
'-h[Print help]' \
'--help[Print help]' \
'*::queries -- Tree query for the gardens, groups or trees to display:_default' \
&& ret=0
;;
(plant)
_arguments "${_arguments_options[@]}" : \
'-o+[Garden configuration file to write \[default\: "garden.yaml"\]]:OUTPUT:_default' \
'--output=[Garden configuration file to write \[default\: "garden.yaml"\]]:OUTPUT:_default' \
'-s[Sort all trees after planting new trees]' \
'--sort[Sort all trees after planting new trees]' \
'*-v[Increase verbosity level (default\: 0)]' \
'*--verbose[Increase verbosity level (default\: 0)]' \
'-h[Print help]' \
'--help[Print help]' \
'*::paths -- Trees to plant:_files -/' \
&& ret=0
;;
(prune)
_arguments "${_arguments_options[@]}" : \
'-j+[Prune repositories in parallel using the specified number of jobs]::JOBS:_default' \
'--jobs=[Prune repositories in parallel using the specified number of jobs]::JOBS:_default' \
'-d+[Set the maximum prune depth]:MAX_DEPTH:_default' \
'--max-depth=[Set the maximum prune depth]:MAX_DEPTH:_default' \
'--min-depth=[Only prune starting at the given depth]:MIN_DEPTH:_default' \
'--exact-depth=[Only prune at the exact depth. Alias for '\''--min-depth=# --max-depth=#'\'']:EXACT_DEPTH:_default' \
'--no-prompt[Prune all repositories without prompting (DANGER!)]' \
'--rm[Enable deletion \[default\: deletion is disabled\]]' \
'-h[Print help]' \
'--help[Print help]' \
'*::paths -- Limit pruning to the specified subdirectories:_default' \
&& ret=0
;;
(shell)
_arguments "${_arguments_options[@]}" : \
'*-v[Increase verbosity level (default\: 0)]' \
'*--verbose[Increase verbosity level (default\: 0)]' \
'-h[Print help]' \
'--help[Print help]' \
'::query -- Query for trees to build an environment:_default' \
'::tree -- Tree to chdir into:_default' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
":: :_garden__help_commands" \
"*::: :->help" \
&& ret=0

    case $state in
    (help)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:garden-help-command-$line[1]:"
        case $line[1] in
            (cmd)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(completion)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(eval)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(exec)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(git)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(grow)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(gui)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(init)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(ls)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(plant)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(prune)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(shell)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
        esac
    ;;
esac
}

(( $+functions[_garden_commands] )) ||
_garden_commands() {
    local commands; commands=(
'cmd:Run custom commands over gardens' \
'completion:Generate shell completions' \
'eval:Evaluate garden expressions' \
'exec:Run commands inside garden environments' \
'git:Execute Git commands' \
'grow:Grow garden worktrees into existence' \
'gui:Garden GUI (run "garden-gui --help" for more details)' \
'init:Initialize a "garden.yaml" garden configuration file' \
'ls:List available gardens, groups, trees and commands' \
'plant:Add pre-existing worktrees to a garden configuration file' \
'prune:Remove unreferenced Git repositories' \
'shell:Open a shell in a garden environment' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'garden commands' commands "$@"
}
(( $+functions[_garden__cmd_commands] )) ||
_garden__cmd_commands() {
    local commands; commands=()
    _describe -t commands 'garden cmd commands' commands "$@"
}
(( $+functions[_garden__completion_commands] )) ||
_garden__completion_commands() {
    local commands; commands=()
    _describe -t commands 'garden completion commands' commands "$@"
}
(( $+functions[_garden__eval_commands] )) ||
_garden__eval_commands() {
    local commands; commands=()
    _describe -t commands 'garden eval commands' commands "$@"
}
(( $+functions[_garden__exec_commands] )) ||
_garden__exec_commands() {
    local commands; commands=()
    _describe -t commands 'garden exec commands' commands "$@"
}
(( $+functions[_garden__git_commands] )) ||
_garden__git_commands() {
    local commands; commands=()
    _describe -t commands 'garden git commands' commands "$@"
}
(( $+functions[_garden__grow_commands] )) ||
_garden__grow_commands() {
    local commands; commands=()
    _describe -t commands 'garden grow commands' commands "$@"
}
(( $+functions[_garden__gui_commands] )) ||
_garden__gui_commands() {
    local commands; commands=()
    _describe -t commands 'garden gui commands' commands "$@"
}
(( $+functions[_garden__help_commands] )) ||
_garden__help_commands() {
    local commands; commands=(
'cmd:Run custom commands over gardens' \
'completion:Generate shell completions' \
'eval:Evaluate garden expressions' \
'exec:Run commands inside garden environments' \
'git:Execute Git commands' \
'grow:Grow garden worktrees into existence' \
'gui:Garden GUI (run "garden-gui --help" for more details)' \
'init:Initialize a "garden.yaml" garden configuration file' \
'ls:List available gardens, groups, trees and commands' \
'plant:Add pre-existing worktrees to a garden configuration file' \
'prune:Remove unreferenced Git repositories' \
'shell:Open a shell in a garden environment' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'garden help commands' commands "$@"
}
(( $+functions[_garden__help__cmd_commands] )) ||
_garden__help__cmd_commands() {
    local commands; commands=()
    _describe -t commands 'garden help cmd commands' commands "$@"
}
(( $+functions[_garden__help__completion_commands] )) ||
_garden__help__completion_commands() {
    local commands; commands=()
    _describe -t commands 'garden help completion commands' commands "$@"
}
(( $+functions[_garden__help__eval_commands] )) ||
_garden__help__eval_commands() {
    local commands; commands=()
    _describe -t commands 'garden help eval commands' commands "$@"
}
(( $+functions[_garden__help__exec_commands] )) ||
_garden__help__exec_commands() {
    local commands; commands=()
    _describe -t commands 'garden help exec commands' commands "$@"
}
(( $+functions[_garden__help__git_commands] )) ||
_garden__help__git_commands() {
    local commands; commands=()
    _describe -t commands 'garden help git commands' commands "$@"
}
(( $+functions[_garden__help__grow_commands] )) ||
_garden__help__grow_commands() {
    local commands; commands=()
    _describe -t commands 'garden help grow commands' commands "$@"
}
(( $+functions[_garden__help__gui_commands] )) ||
_garden__help__gui_commands() {
    local commands; commands=()
    _describe -t commands 'garden help gui commands' commands "$@"
}
(( $+functions[_garden__help__help_commands] )) ||
_garden__help__help_commands() {
    local commands; commands=()
    _describe -t commands 'garden help help commands' commands "$@"
}
(( $+functions[_garden__help__init_commands] )) ||
_garden__help__init_commands() {
    local commands; commands=()
    _describe -t commands 'garden help init commands' commands "$@"
}
(( $+functions[_garden__help__ls_commands] )) ||
_garden__help__ls_commands() {
    local commands; commands=()
    _describe -t commands 'garden help ls commands' commands "$@"
}
(( $+functions[_garden__help__plant_commands] )) ||
_garden__help__plant_commands() {
    local commands; commands=()
    _describe -t commands 'garden help plant commands' commands "$@"
}
(( $+functions[_garden__help__prune_commands] )) ||
_garden__help__prune_commands() {
    local commands; commands=()
    _describe -t commands 'garden help prune commands' commands "$@"
}
(( $+functions[_garden__help__shell_commands] )) ||
_garden__help__shell_commands() {
    local commands; commands=()
    _describe -t commands 'garden help shell commands' commands "$@"
}
(( $+functions[_garden__init_commands] )) ||
_garden__init_commands() {
    local commands; commands=()
    _describe -t commands 'garden init commands' commands "$@"
}
(( $+functions[_garden__ls_commands] )) ||
_garden__ls_commands() {
    local commands; commands=()
    _describe -t commands 'garden ls commands' commands "$@"
}
(( $+functions[_garden__plant_commands] )) ||
_garden__plant_commands() {
    local commands; commands=()
    _describe -t commands 'garden plant commands' commands "$@"
}
(( $+functions[_garden__prune_commands] )) ||
_garden__prune_commands() {
    local commands; commands=()
    _describe -t commands 'garden prune commands' commands "$@"
}
(( $+functions[_garden__shell_commands] )) ||
_garden__shell_commands() {
    local commands; commands=()
    _describe -t commands 'garden shell commands' commands "$@"
}

if [ "$funcstack[1]" = "_garden" ]; then
    _garden "$@"
else
    compdef _garden garden
fi

# Generated by garden v2.6.0.
