From 6214c1ef07f0e16990d17b23aa2401abf93c7ad8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 13 May 2026 19:55:28 +0000 Subject: [PATCH] build(deps): Bump github.com/urfave/cli/v3 from 3.8.0 to 3.9.0 Bumps [github.com/urfave/cli/v3](https://github.com/urfave/cli) from 3.8.0 to 3.9.0. - [Release notes](https://github.com/urfave/cli/releases) - [Changelog](https://github.com/urfave/cli/blob/main/docs/CHANGELOG.md) - [Commits](https://github.com/urfave/cli/compare/v3.8.0...v3.9.0) --- updated-dependencies: - dependency-name: github.com/urfave/cli/v3 dependency-version: 3.9.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 +- .../cli/v3/autocomplete/bash_autocomplete | 111 +++++++++++++++--- .../cli/v3/autocomplete/fish_autocomplete | 14 +-- .../autocomplete/powershell_autocomplete.ps1 | 17 ++- vendor/github.com/urfave/cli/v3/command.go | 6 + .../github.com/urfave/cli/v3/command_parse.go | 17 +++ .../github.com/urfave/cli/v3/command_run.go | 5 +- vendor/github.com/urfave/cli/v3/errors.go | 10 +- .../urfave/cli/v3/flag_bool_with_inverse.go | 27 ++++- .../urfave/cli/v3/godoc-current.txt | 3 + vendor/github.com/urfave/cli/v3/help.go | 31 ++--- .../urfave/cli/v3/mkdocs-requirements.txt | 6 +- vendor/modules.txt | 2 +- 14 files changed, 188 insertions(+), 67 deletions(-) diff --git a/go.mod b/go.mod index d9cd82957..cef2f6dc2 100644 --- a/go.mod +++ b/go.mod @@ -21,7 +21,7 @@ require ( github.com/regclient/regclient v0.11.4 github.com/sirupsen/logrus v1.9.4 github.com/stretchr/testify v1.11.1 - github.com/urfave/cli/v3 v3.8.0 + github.com/urfave/cli/v3 v3.9.0 go.uber.org/zap v1.28.0 golang.org/x/mod v0.36.0 k8s.io/api v0.36.1 diff --git a/go.sum b/go.sum index 85b8a1ad9..4d1d30abe 100644 --- a/go.sum +++ b/go.sum @@ -230,8 +230,8 @@ github.com/tidwall/sjson v1.2.5 h1:kLy8mja+1c9jlljvWTlSazM7cKDRfJuR/bOJhcY5NcY= github.com/tidwall/sjson v1.2.5/go.mod h1:Fvgq9kS/6ociJEDnK0Fk1cpYF4FIW6ZF7LAe+6jwd28= github.com/ulikunitz/xz v0.5.15 h1:9DNdB5s+SgV3bQ2ApL10xRc35ck0DuIX/isZvIk+ubY= github.com/ulikunitz/xz v0.5.15/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= -github.com/urfave/cli/v3 v3.8.0 h1:XqKPrm0q4P0q5JpoclYoCAv0/MIvH/jZ2umzuf8pNTI= -github.com/urfave/cli/v3 v3.8.0/go.mod h1:ysVLtOEmg2tOy6PknnYVhDoouyC/6N42TMeoMzskhso= +github.com/urfave/cli/v3 v3.9.0 h1:AV9lIiPv3ukYnxunaCUsHnEozptYmDN2F0+yWqLMn/c= +github.com/urfave/cli/v3 v3.9.0/go.mod h1:ysVLtOEmg2tOy6PknnYVhDoouyC/6N42TMeoMzskhso= github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= github.com/xlab/treeprint v1.2.0 h1:HzHnuAF1plUN2zGlAFHbSQP2qJ0ZAD3XF5XD7OesXRQ= diff --git a/vendor/github.com/urfave/cli/v3/autocomplete/bash_autocomplete b/vendor/github.com/urfave/cli/v3/autocomplete/bash_autocomplete index d63937d97..fd08201e4 100644 --- a/vendor/github.com/urfave/cli/v3/autocomplete/bash_autocomplete +++ b/vendor/github.com/urfave/cli/v3/autocomplete/bash_autocomplete @@ -1,32 +1,105 @@ -#!/bin/bash - # This is a shell completion script auto-generated by https://github.com/urfave/cli for bash. -# Macs have bash3 for which the bash-completion package doesn't include -# _init_completion. This is a minimal version of that function. +# macOS still ships Bash 3, where bash-completion may not provide +# _init_completion. This is a minimal compatible fallback. __%[1]s_init_completion() { COMPREPLY=() - _get_comp_words_by_ref "$@" cur prev words cword + if declare -F _comp_initialize >/dev/null 2>&1; then + _comp_initialize "$@" + else + _get_comp_words_by_ref "$@" cur prev words cword + fi +} + +__%[1]s_build_completion_request() { + local -a words_before_cursor=("${COMP_WORDS[@]:0:${COMP_CWORD}}") + local current_word="${COMP_WORDS[COMP_CWORD]}" + + if [[ "${current_word}" == "-"* ]]; then + printf '%%s %%s --generate-shell-completion' "${words_before_cursor[*]}" "${current_word}" + else + printf '%%s --generate-shell-completion' "${words_before_cursor[*]}" + fi +} + +# Keep Bash 3 compatibility: associative arrays require Bash 4+, so +# descriptions are looked up via parallel indexed arrays. +__%[1]s_find_description_for() { + local candidate="$1" + local i + + for i in "${!__cli_completion_tokens[@]}"; do + if [[ "${__cli_completion_tokens[i]}" == "${candidate}" ]]; then + printf '%%s' "${__cli_completion_descriptions[i]}" + return 0 + fi + done + + return 1 } __%[1]s_bash_autocomplete() { - if [[ "${COMP_WORDS[0]}" != "source" ]]; then - local cur opts base words + local words=("${COMP_WORDS[@]}") + + if [[ "${words[0]}" != "source" ]]; then + local cur opts + local cword="${COMP_CWORD}" + local request_comp + COMPREPLY=() - cur="${COMP_WORDS[COMP_CWORD]}" - if declare -F _init_completion >/dev/null 2>&1; then - _init_completion -n "=:" || return - else - __%[1]s_init_completion -n "=:" || return - fi - words=("${words[@]:0:$cword}") - if [[ "$cur" == "-"* ]]; then - requestComp="${words[*]} ${cur} --generate-shell-completion" + cur="${words[$cword]}" + + __%[1]s_init_completion -n "=:" || return + + request_comp="$(__%[1]s_build_completion_request)" + opts=$(eval "${request_comp}" 2>/dev/null) + + # Completion output lines use "token:description" format. + # Keep token/description in parallel arrays for Bash 3 compatibility. + __cli_completion_tokens=() + __cli_completion_descriptions=() + + local line + local longest=0 + while IFS=$'\n' read -r line; do + local token="${line}" + local description="" + + if [[ "${line}" == *:* ]]; then + token="${line%%:*}" + description="${line#*:}" + fi + + if [[ -z "${token}" ]]; then + continue + fi + + __cli_completion_tokens+=("${token}") + __cli_completion_descriptions+=("${description}") + (( ${#token} > longest )) && longest=${#token} + done <<< "${opts}" + + local matches=( $(compgen -W "${__cli_completion_tokens[*]}" -- "${cur}") ) + + # COMP_TYPE=63 means Bash is listing matches (usually on second TAB). + if [[ "${COMP_TYPE:-}" == "63" && ${#matches[@]} -gt 0 ]]; then + local listed=() + local candidate + for candidate in "${matches[@]}"; do + local desc="$(__%[1]s_find_description_for "${candidate}")" + + if [[ -n "${desc}" ]]; then + local padded="$(printf '%%-*s' "${longest}" "${candidate}")" + listed+=("${padded} -- ${desc}") + else + listed+=("${candidate}") + fi + done + COMPREPLY=("${listed[@]}") else - requestComp="${words[*]} --generate-shell-completion" + COMPREPLY=("${matches[@]}") fi - opts=$(eval "${requestComp}" 2>/dev/null) - COMPREPLY=($(compgen -W "${opts}" -- ${cur})) + return 0 fi } diff --git a/vendor/github.com/urfave/cli/v3/autocomplete/fish_autocomplete b/vendor/github.com/urfave/cli/v3/autocomplete/fish_autocomplete index 7aa7d0a8b..6714f75e0 100644 --- a/vendor/github.com/urfave/cli/v3/autocomplete/fish_autocomplete +++ b/vendor/github.com/urfave/cli/v3/autocomplete/fish_autocomplete @@ -1,6 +1,6 @@ # This is a shell completion script auto-generated by https://github.com/urfave/cli for fish. -function __%[1]_perform_completion +function __%[1]s_perform_completion # Extract all args except the last one set -l args (commandline -opc) # Extract the last arg (partial input) @@ -18,18 +18,18 @@ function __%[1]_perform_completion end for line in $results - if not string match -q -- "%[1]*" $line + if not string match -q -- "%[1]s*" $line set -l parts (string split -m 1 ":" -- "$line") if test (count $parts) -eq 2 - printf "%s\t%s\n" "$parts[1]" "$parts[2]" + printf "%%s\t%%s\n" "$parts[1]" "$parts[2]" else - printf "%s\n" "$line" + printf "%%s\n" "$line" end end end end -# Clear existing completions for %[1] -complete -c %[1] -e +# Clear existing completions for %[1]s +complete -c %[1]s -e # Register completion function -complete -c %[1] -f -a '(__%[1]_perform_completion)' \ No newline at end of file +complete -c %[1]s -f -a '(__%[1]s_perform_completion)' \ No newline at end of file diff --git a/vendor/github.com/urfave/cli/v3/autocomplete/powershell_autocomplete.ps1 b/vendor/github.com/urfave/cli/v3/autocomplete/powershell_autocomplete.ps1 index 6e0c422e2..fee6d0c7d 100644 --- a/vendor/github.com/urfave/cli/v3/autocomplete/powershell_autocomplete.ps1 +++ b/vendor/github.com/urfave/cli/v3/autocomplete/powershell_autocomplete.ps1 @@ -1,9 +1,16 @@ $fn = $($MyInvocation.MyCommand.Name) $name = $fn -replace "(.*)\.ps1$", '$1' Register-ArgumentCompleter -Native -CommandName $name -ScriptBlock { - param($commandName, $wordToComplete, $cursorPosition) - $other = "$wordToComplete --generate-shell-completion" - Invoke-Expression $other | ForEach-Object { + param($commandName, $wordToComplete, $cursorPosition) + $other = "$wordToComplete --generate-shell-completion" + Invoke-Expression $other | ForEach-Object { + $parts = $_.Split(':', 2) + if ($parts.Count -eq 2) { + $completion = $parts[0].Trim() + $description = $parts[1].Trim() + [System.Management.Automation.CompletionResult]::new($completion, $completion, 'ParameterValue', $description) + } else { [System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_) - } - } + } + } +} \ No newline at end of file diff --git a/vendor/github.com/urfave/cli/v3/command.go b/vendor/github.com/urfave/cli/v3/command.go index 2a46b2eab..d1a9d0575 100644 --- a/vendor/github.com/urfave/cli/v3/command.go +++ b/vendor/github.com/urfave/cli/v3/command.go @@ -408,6 +408,12 @@ func (cmd *Command) checkRequiredFlag(f Flag) (bool, string) { } func (cmd *Command) checkAllRequiredFlags() requiredFlagsErr { + // The help and completion commands are allowed to run without + // enforcement of required flags, since they do not invoke user + // actions that depend on those flag values. + if cmd.Name == helpName || cmd.isCompletionCommand { + return nil + } for pCmd := cmd; pCmd != nil; pCmd = pCmd.parent { if err := pCmd.checkRequiredFlags(); err != nil { return err diff --git a/vendor/github.com/urfave/cli/v3/command_parse.go b/vendor/github.com/urfave/cli/v3/command_parse.go index 92c58eeaa..2b9a481df 100644 --- a/vendor/github.com/urfave/cli/v3/command_parse.go +++ b/vendor/github.com/urfave/cli/v3/command_parse.go @@ -86,6 +86,11 @@ func (cmd *Command) parseFlags(args Args) (Args, error) { // stop parsing once we see a "--" if firstArg == "--" { + // In shell completion mode, preserve "--" so that completion can detect + // when the user is completing "--" itself vs. completing after "--" + if cmd.Root().shellCompletion { + posArgs = append(posArgs, firstArg) + } posArgs = append(posArgs, rargs[1:]...) return &stringSliceArgs{posArgs}, nil } @@ -166,6 +171,12 @@ func (cmd *Command) parseFlags(args Args) (Args, error) { // not a bool flag so need to get the next arg if flagVal == "" && !valFromEqual { if len(rargs) == 1 { + // In shell completion mode, preserve the flag so that DefaultCompleteWithFlags can use it + // as lastArg and offer suggestions for it. + if cmd.Root().shellCompletion { + posArgs = append(posArgs, rargs...) + return &stringSliceArgs{posArgs}, nil + } return &stringSliceArgs{posArgs}, fmt.Errorf("%s%s", argumentNotProvidedErrMsg, firstArg) } flagVal = rargs[1] @@ -182,6 +193,12 @@ func (cmd *Command) parseFlags(args Args) (Args, error) { // no flag lookup found and short handling is disabled if !shortOptionHandling { + // In shell completion mode, preserve the partial flag so that DefaultCompleteWithFlags can use it + // as lastArg and offer suggestions that match the prefix. + if cmd.Root().shellCompletion { + posArgs = append(posArgs, rargs...) + return &stringSliceArgs{posArgs}, nil + } return &stringSliceArgs{posArgs}, fmt.Errorf("%s%s", providedButNotDefinedErrMsg, flagName) } diff --git a/vendor/github.com/urfave/cli/v3/command_run.go b/vendor/github.com/urfave/cli/v3/command_run.go index 676a14c67..269dd85f2 100644 --- a/vendor/github.com/urfave/cli/v3/command_run.go +++ b/vendor/github.com/urfave/cli/v3/command_run.go @@ -141,8 +141,8 @@ func (cmd *Command) run(ctx context.Context, osArgs []string) (_ context.Context var rargs Args = &stringSliceArgs{v: osArgs} var args Args = &stringSliceArgs{rargs.Tail()} - if cmd.isCompletionCommand || cmd.Name == helpName { - tracef("special command detected, skipping pre-parse (cmd=%[1]q)", cmd.Name) + if cmd.isCompletionCommand { + tracef("completion command detected, skipping pre-parse (cmd=%[1]q)", cmd.Name) cmd.parsedArgs = args return ctx, cmd.Action(ctx, cmd) } @@ -213,6 +213,7 @@ func (cmd *Command) run(ctx context.Context, osArgs []string) (_ context.Context } for _, flag := range cmd.allFlags() { + cmd.setMultiValueParsingConfig(flag) isSet := flag.IsSet() if err := flag.PostParse(); err != nil { return ctx, err diff --git a/vendor/github.com/urfave/cli/v3/errors.go b/vendor/github.com/urfave/cli/v3/errors.go index f365a5799..ffd6471f2 100644 --- a/vendor/github.com/urfave/cli/v3/errors.go +++ b/vendor/github.com/urfave/cli/v3/errors.go @@ -150,10 +150,12 @@ func HandleExitCoder(err error) { } if exitErr, ok := err.(ExitCoder); ok { - if _, ok := exitErr.(ErrorFormatter); ok { - _, _ = fmt.Fprintf(ErrWriter, "%+v\n", err) - } else { - _, _ = fmt.Fprintln(ErrWriter, err) + if msg := err.Error(); msg != "" { + if _, ok := exitErr.(ErrorFormatter); ok { + _, _ = fmt.Fprintf(ErrWriter, "%+v\n", err) + } else { + _, _ = fmt.Fprintln(ErrWriter, err) + } } OsExiter(exitErr.ExitCode()) return diff --git a/vendor/github.com/urfave/cli/v3/flag_bool_with_inverse.go b/vendor/github.com/urfave/cli/v3/flag_bool_with_inverse.go index 272dd98fe..8666e2d3d 100644 --- a/vendor/github.com/urfave/cli/v3/flag_bool_with_inverse.go +++ b/vendor/github.com/urfave/cli/v3/flag_bool_with_inverse.go @@ -167,6 +167,9 @@ func (bif *BoolWithInverseFlag) IsVisible() bool { // // Example for BoolFlag{Name: "env"} // --[no-]env (default: false) +// +// Example for BoolFlag{Name: "env", Aliases: []string{"e"}} +// --[no-]env, -e (default: false) func (bif *BoolWithInverseFlag) String() string { out := FlagStringer(bif) @@ -179,7 +182,29 @@ func (bif *BoolWithInverseFlag) String() string { prefix = "-" } - return fmt.Sprintf("%s[%s]%s%s", prefix, bif.inversePrefix(), bif.Name, out[i:]) + // Guard against a FlagStringer that returns a string without a tab (e.g. + // a custom stringer or the default stringer when the flag does not + // implement DocGenerationFlag). In that case treat the entire output as + // the tab-delimited suffix so the slice never goes out of bounds. + if i < 0 { + i = 0 + } + + var aliasParts []string + for _, alias := range bif.Aliases { + aPrefix := "--" + if len(alias) == 1 { + aPrefix = "-" + } + aliasParts = append(aliasParts, aPrefix+alias) + } + + names := fmt.Sprintf("%s[%s]%s", prefix, bif.inversePrefix(), bif.Name) + if len(aliasParts) > 0 { + names = names + ", " + strings.Join(aliasParts, ", ") + } + + return fmt.Sprintf("%s%s", names, out[i:]) } // IsBoolFlag returns whether the flag doesnt need to accept args diff --git a/vendor/github.com/urfave/cli/v3/godoc-current.txt b/vendor/github.com/urfave/cli/v3/godoc-current.txt index a31fb2108..1e163a0cb 100644 --- a/vendor/github.com/urfave/cli/v3/godoc-current.txt +++ b/vendor/github.com/urfave/cli/v3/godoc-current.txt @@ -414,6 +414,9 @@ func (bif *BoolWithInverseFlag) String() string Example for BoolFlag{Name: "env"} --[no-]env (default: false) + Example for BoolFlag{Name: "env", Aliases: []string{"e"}} --[no-]env, + -e (default: false) + func (bif *BoolWithInverseFlag) TakesValue() bool func (bif *BoolWithInverseFlag) TypeName() string diff --git a/vendor/github.com/urfave/cli/v3/help.go b/vendor/github.com/urfave/cli/v3/help.go index 0f7f629ca..1fba6edf0 100644 --- a/vendor/github.com/urfave/cli/v3/help.go +++ b/vendor/github.com/urfave/cli/v3/help.go @@ -126,16 +126,8 @@ func helpCommandAction(ctx context.Context, cmd *Command) error { // Case 3, 5 if len(cmd.VisibleCommands()) == 0 { - - tmpl := cmd.CustomHelpTemplate - if tmpl == "" { - tmpl = CommandHelpTemplate - } - tracef("running HelpPrinter with command %[1]q", cmd.Name) - HelpPrinter(cmd.Root().Writer, tmpl, cmd) - - return nil + return ShowCommandHelp(ctx, cmd.parent, cmd.Name) } tracef("running ShowSubcommandHelp") @@ -184,12 +176,11 @@ func DefaultRootCommandComplete(ctx context.Context, cmd *Command) { var DefaultAppComplete = DefaultRootCommandComplete func printCommandSuggestions(commands []*Command, writer io.Writer) { - shell := os.Getenv("SHELL") for _, command := range commands { if command.Hidden { continue } - if (strings.HasSuffix(shell, "zsh") || strings.HasSuffix(shell, "fish")) && len(command.Usage) > 0 { + if len(command.Usage) > 0 { _, _ = fmt.Fprintf(writer, "%s:%s\n", command.Name, command.Usage) } else { _, _ = fmt.Fprintf(writer, "%s\n", command.Name) @@ -239,8 +230,7 @@ func printFlagSuggestions(lastArg string, flags []Flag, writer io.Writer) { // match if last argument matches this flag and it is not repeated if strings.HasPrefix(name, cur) && cur != name /* && !cliArgContains(name, os.Args)*/ { flagCompletion := fmt.Sprintf("%s%s", strings.Repeat("-", count), name) - shell := os.Getenv("SHELL") - if usage != "" && (strings.HasSuffix(shell, "zsh") || strings.HasSuffix(shell, "fish")) { + if usage != "" { flagCompletion = fmt.Sprintf("%s:%s", flagCompletion, usage) } fmt.Fprintln(writer, flagCompletion) @@ -266,11 +256,6 @@ func DefaultCompleteWithFlags(ctx context.Context, cmd *Command) { lastArg = args[argsLen-1] } - if lastArg == "--" { - tracef("No completions due to termination") - return - } - if lastArg == completionFlag { lastArg = "" } @@ -303,7 +288,7 @@ func DefaultShowCommandHelp(ctx context.Context, cmd *Command, commandName strin tmpl := subCmd.CustomHelpTemplate if tmpl == "" { - if len(subCmd.Commands) == 0 { + if len(subCmd.VisibleCommands()) == 0 { tracef("using CommandHelpTemplate") tmpl = CommandHelpTemplate } else { @@ -495,10 +480,12 @@ func checkShellCompleteFlag(c *Command, arguments []string) (bool, []string) { return false, arguments } - // If arguments include "--", shell completion is disabled - // because after "--" only positional arguments are accepted. + // If arguments include "--" before the token being completed, shell completion + // is disabled because after "--" only positional arguments are accepted. // https://unix.stackexchange.com/a/11382 - if slices.Contains(arguments, "--") { + // Note: The token being completed is at position pos-1 (immediately before completionFlag). + // We only check arguments before that position, so completing "--" itself still works. + if pos >= 1 && slices.Contains(arguments[:pos-1], "--") { return false, arguments[:pos] } diff --git a/vendor/github.com/urfave/cli/v3/mkdocs-requirements.txt b/vendor/github.com/urfave/cli/v3/mkdocs-requirements.txt index e5848c726..d7f1b2c69 100644 --- a/vendor/github.com/urfave/cli/v3/mkdocs-requirements.txt +++ b/vendor/github.com/urfave/cli/v3/mkdocs-requirements.txt @@ -1,5 +1,5 @@ mkdocs-git-revision-date-localized-plugin==1.5.1 -mkdocs-material==9.7.5 +mkdocs-material==9.7.6 mkdocs==1.6.1 -mkdocs-redirects==1.2.2 -pygments==2.19.2 +mkdocs-redirects==1.2.3 +pygments==2.20.0 diff --git a/vendor/modules.txt b/vendor/modules.txt index 206a73069..d61fdb107 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -395,7 +395,7 @@ github.com/ulikunitz/xz github.com/ulikunitz/xz/internal/hash github.com/ulikunitz/xz/internal/xlog github.com/ulikunitz/xz/lzma -# github.com/urfave/cli/v3 v3.8.0 +# github.com/urfave/cli/v3 v3.9.0 ## explicit; go 1.22 github.com/urfave/cli/v3 # github.com/x448/float16 v0.8.4