#compdef cog

autoload -U is-at-least

_cog() {
    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[@]}" \
'*-v[The level of verbosity\: -v for ERROR, -vv for WARNING, -vvv for INFO]' \
'*--verbose[The level of verbosity\: -v for ERROR, -vv for WARNING, -vvv for INFO]' \
'-q[Silence all output, no matter the value of verbosity]' \
'--quiet[Silence all output, no matter the value of verbosity]' \
'-h[Print help]' \
'--help[Print help]' \
'-V[Print version]' \
'--version[Print version]' \
":: :_cog_commands" \
"*::: :->cog" \
&& ret=0
    case $state in
    (cog)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:cog-command-$line[1]:"
        case $line[1] in
            (check)
_arguments "${_arguments_options[@]}" \
'-l[Check commit history, starting from the latest tag to HEAD]' \
'--from-latest-tag[Check commit history, starting from the latest tag to HEAD]' \
'-i[Ignore merge commits messages]' \
'--ignore-merge-commits[Ignore merge commits messages]' \
'--ignore-fixup-commits[Ignore fixup!, squash! and amend! commit messages]' \
'-h[Print help]' \
'--help[Print help]' \
'::range -- Check commits in the specified range:' \
&& ret=0
;;
(commit)
_arguments "${_arguments_options[@]}" \
'--skip-ci-override=[Override and add the <SKIP_CI_OVERRIDE> string to the commit]:SKIP_CI_OVERRIDE: ' \
'-B[Create a BREAKING CHANGE commit]' \
'--breaking-change[Create a BREAKING CHANGE commit]' \
'-e[Open commit message in an editor]' \
'--edit[Open commit message in an editor]' \
'-s[Sign this commit]' \
'--sign[Sign this commit]' \
'--skip-ci[Add the skip-ci string defined in the cog.toml (or defaults to \[skip ci\]) to the commit]' \
'-a[Add files to the commit (similar to git add .)]' \
'--add[Add files to the commit (similar to git add .)]' \
'-u[Update but doesn'\''t add files to the commit (similar to git add -u .)]' \
'--update[Update but doesn'\''t add files to the commit (similar to git add -u .)]' \
'-h[Print help]' \
'--help[Print help]' \
':type -- Conventional commit type:(build chore ci docs feat fix perf refactor revert style test)' \
':message -- Commit description:' \
'::scope -- Conventional commit scope:' \
&& ret=0
;;
(edit)
_arguments "${_arguments_options[@]}" \
'-l[Edit non conventional commits, starting from the latest tag to HEAD]' \
'--from-latest-tag[Edit non conventional commits, starting from the latest tag to HEAD]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(log)
_arguments "${_arguments_options[@]}" \
'*-t+[Filter on commit type]:type: ' \
'*--type=[Filter on commit type]:type: ' \
'*-a+[Filter on commit author]:AUTHOR: ' \
'*--author=[Filter on commit author]:AUTHOR: ' \
'*-s+[Filter on commit scope]:SCOPE: ' \
'*--scope=[Filter on commit scope]:SCOPE: ' \
'-B[Filter BREAKING CHANGE commits]' \
'--breaking-change[Filter BREAKING CHANGE commits]' \
'-e[Omit error on the commit log]' \
'--no-error[Omit error on the commit log]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(verify)
_arguments "${_arguments_options[@]}" \
'-f+[Read message from the specified file]:FILE:_files' \
'--file=[Read message from the specified file]:FILE:_files' \
'-i[Ignore merge commit messages]' \
'--ignore-merge-commits[Ignore merge commit messages]' \
'--ignore-fixup-commits[Ignore fixup!, squash! and amend! commit messages]' \
'-h[Print help]' \
'--help[Print help]' \
'::message -- The commit message:' \
&& ret=0
;;
(changelog)
_arguments "${_arguments_options[@]}" \
'-a+[Generate the changelog for a specific git tag]:AT: ' \
'--at=[Generate the changelog for a specific git tag]:AT: ' \
'-t+[Generate the changelog with the given template]:TEMPLATE: ' \
'--template=[Generate the changelog with the given template]:TEMPLATE: ' \
'-r+[Url to use during template generation]:REMOTE: ' \
'--remote=[Url to use during template generation]:REMOTE: ' \
'-o+[Repository owner to use during template generation]:OWNER: ' \
'--owner=[Repository owner to use during template generation]:OWNER: ' \
'--repository=[Name of the repository used during template generation]:REPOSITORY: ' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
'::pattern -- Generate the changelog in the given spec range:' \
&& ret=0
;;
(get-version)
_arguments "${_arguments_options[@]}" \
'-f+[Fallback version. Has to be semver compliant]:FALLBACK: ' \
'--fallback=[Fallback version. Has to be semver compliant]:FALLBACK: ' \
'--package=[Specify which package to get the version for in a monorepo]:PACKAGE:()' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(bump)
_arguments "${_arguments_options[@]}" \
'--version=[Manually set the target version]:VERSION: ' \
'--pre=[Set the pre-release version]:PRE: ' \
'--build=[Set the build suffix]:BUILD: ' \
'-H+[Specify the bump profile hooks to run]:HOOK_PROFILE:()' \
'--hook-profile=[Specify the bump profile hooks to run]:HOOK_PROFILE:()' \
'--package=[Specify which package to bump for monorepo]:PACKAGE:()' \
'-A+[Annotate tag with given message]:ANNOTATED: ' \
'--annotated=[Annotate tag with given message]:ANNOTATED: ' \
'--skip-ci-override=[Override and add the skip-ci string with the provided value to the bump commit]:SKIP_CI_OVERRIDE: ' \
'-a[Automatically suggest the target version]' \
'--auto[Automatically suggest the target version]' \
'-M[Increment the major version]' \
'--major[Increment the major version]' \
'-m[Increment the minor version]' \
'--minor[Increment the minor version]' \
'-p[Increment the patch version]' \
'--patch[Increment the patch version]' \
'-d[Dry-run\: print the target version. No action taken]' \
'--dry-run[Dry-run\: print the target version. No action taken]' \
'--skip-ci[Add the skip-ci string defined in the cog.toml (or defaults to \[skip ci\]) to the bump commit]' \
'--skip-untracked[Don'\''t fail if there are untracked or uncommitted files]' \
'--disable-bump-commit[Disable the creation of the bump commit]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(init)
_arguments "${_arguments_options[@]}" \
'-h[Print help]' \
'--help[Print help]' \
'::path -- Path to initialized dir:_files' \
&& ret=0
;;
(install-hook)
_arguments "${_arguments_options[@]}" \
'-a[Install all git-hooks]' \
'--all[Install all git-hooks]' \
'-o[Overwrite existing git-hooks]' \
'--overwrite[Overwrite existing git-hooks]' \
'-h[Print help]' \
'--help[Print help]' \
'*::hook_type -- Type of hook to install:()' \
&& ret=0
;;
(generate-completions)
_arguments "${_arguments_options[@]}" \
'-h[Print help]' \
'--help[Print help]' \
':shell -- Shell to generate completions for:(bash elvish fish powershell zsh nu)' \
&& ret=0
;;
(generate-manpages)
_arguments "${_arguments_options[@]}" \
'-h[Print help]' \
'--help[Print help]' \
':output_dir:_files' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" \
":: :_cog__help_commands" \
"*::: :->help" \
&& ret=0

    case $state in
    (help)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:cog-help-command-$line[1]:"
        case $line[1] in
            (check)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(commit)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(edit)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(log)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(verify)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(changelog)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(get-version)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(bump)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(init)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(install-hook)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(generate-completions)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(generate-manpages)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
        esac
    ;;
esac
;;
        esac
    ;;
esac
}

(( $+functions[_cog_commands] )) ||
_cog_commands() {
    local commands; commands=(
'check:Verify all commit messages against the conventional commit specification' \
'commit:Create a new conventional commit' \
'edit:Interactively rename invalid commit messages' \
'log:Like git log but for conventional commits' \
'verify:Verify a single commit message' \
'changelog:Display a changelog for the given commit oid range' \
'get-version:Get current version' \
'bump:Commit changelog from latest tag to HEAD and create new tag' \
'init:Install cog config files' \
'install-hook:Add git hooks to the repository' \
'generate-completions:Generate shell completions' \
'generate-manpages:Generate manpage' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'cog commands' commands "$@"
}
(( $+functions[_cog__bump_commands] )) ||
_cog__bump_commands() {
    local commands; commands=()
    _describe -t commands 'cog bump commands' commands "$@"
}
(( $+functions[_cog__help__bump_commands] )) ||
_cog__help__bump_commands() {
    local commands; commands=()
    _describe -t commands 'cog help bump commands' commands "$@"
}
(( $+functions[_cog__changelog_commands] )) ||
_cog__changelog_commands() {
    local commands; commands=()
    _describe -t commands 'cog changelog commands' commands "$@"
}
(( $+functions[_cog__help__changelog_commands] )) ||
_cog__help__changelog_commands() {
    local commands; commands=()
    _describe -t commands 'cog help changelog commands' commands "$@"
}
(( $+functions[_cog__check_commands] )) ||
_cog__check_commands() {
    local commands; commands=()
    _describe -t commands 'cog check commands' commands "$@"
}
(( $+functions[_cog__help__check_commands] )) ||
_cog__help__check_commands() {
    local commands; commands=()
    _describe -t commands 'cog help check commands' commands "$@"
}
(( $+functions[_cog__commit_commands] )) ||
_cog__commit_commands() {
    local commands; commands=()
    _describe -t commands 'cog commit commands' commands "$@"
}
(( $+functions[_cog__help__commit_commands] )) ||
_cog__help__commit_commands() {
    local commands; commands=()
    _describe -t commands 'cog help commit commands' commands "$@"
}
(( $+functions[_cog__edit_commands] )) ||
_cog__edit_commands() {
    local commands; commands=()
    _describe -t commands 'cog edit commands' commands "$@"
}
(( $+functions[_cog__help__edit_commands] )) ||
_cog__help__edit_commands() {
    local commands; commands=()
    _describe -t commands 'cog help edit commands' commands "$@"
}
(( $+functions[_cog__generate-completions_commands] )) ||
_cog__generate-completions_commands() {
    local commands; commands=()
    _describe -t commands 'cog generate-completions commands' commands "$@"
}
(( $+functions[_cog__help__generate-completions_commands] )) ||
_cog__help__generate-completions_commands() {
    local commands; commands=()
    _describe -t commands 'cog help generate-completions commands' commands "$@"
}
(( $+functions[_cog__generate-manpages_commands] )) ||
_cog__generate-manpages_commands() {
    local commands; commands=()
    _describe -t commands 'cog generate-manpages commands' commands "$@"
}
(( $+functions[_cog__help__generate-manpages_commands] )) ||
_cog__help__generate-manpages_commands() {
    local commands; commands=()
    _describe -t commands 'cog help generate-manpages commands' commands "$@"
}
(( $+functions[_cog__get-version_commands] )) ||
_cog__get-version_commands() {
    local commands; commands=()
    _describe -t commands 'cog get-version commands' commands "$@"
}
(( $+functions[_cog__help__get-version_commands] )) ||
_cog__help__get-version_commands() {
    local commands; commands=()
    _describe -t commands 'cog help get-version commands' commands "$@"
}
(( $+functions[_cog__help_commands] )) ||
_cog__help_commands() {
    local commands; commands=(
'check:Verify all commit messages against the conventional commit specification' \
'commit:Create a new conventional commit' \
'edit:Interactively rename invalid commit messages' \
'log:Like git log but for conventional commits' \
'verify:Verify a single commit message' \
'changelog:Display a changelog for the given commit oid range' \
'get-version:Get current version' \
'bump:Commit changelog from latest tag to HEAD and create new tag' \
'init:Install cog config files' \
'install-hook:Add git hooks to the repository' \
'generate-completions:Generate shell completions' \
'generate-manpages:Generate manpage' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'cog help commands' commands "$@"
}
(( $+functions[_cog__help__help_commands] )) ||
_cog__help__help_commands() {
    local commands; commands=()
    _describe -t commands 'cog help help commands' commands "$@"
}
(( $+functions[_cog__help__init_commands] )) ||
_cog__help__init_commands() {
    local commands; commands=()
    _describe -t commands 'cog help init commands' commands "$@"
}
(( $+functions[_cog__init_commands] )) ||
_cog__init_commands() {
    local commands; commands=()
    _describe -t commands 'cog init commands' commands "$@"
}
(( $+functions[_cog__help__install-hook_commands] )) ||
_cog__help__install-hook_commands() {
    local commands; commands=()
    _describe -t commands 'cog help install-hook commands' commands "$@"
}
(( $+functions[_cog__install-hook_commands] )) ||
_cog__install-hook_commands() {
    local commands; commands=()
    _describe -t commands 'cog install-hook commands' commands "$@"
}
(( $+functions[_cog__help__log_commands] )) ||
_cog__help__log_commands() {
    local commands; commands=()
    _describe -t commands 'cog help log commands' commands "$@"
}
(( $+functions[_cog__log_commands] )) ||
_cog__log_commands() {
    local commands; commands=()
    _describe -t commands 'cog log commands' commands "$@"
}
(( $+functions[_cog__help__verify_commands] )) ||
_cog__help__verify_commands() {
    local commands; commands=()
    _describe -t commands 'cog help verify commands' commands "$@"
}
(( $+functions[_cog__verify_commands] )) ||
_cog__verify_commands() {
    local commands; commands=()
    _describe -t commands 'cog verify commands' commands "$@"
}

if [ "$funcstack[1]" = "_cog" ]; then
    _cog "$@"
else
    compdef _cog cog
fi

