From f50bf31561e0bf28c334bf47e0be707d62dfb83d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 13 Aug 2025 11:33:17 +0000 Subject: [PATCH] chore(deps): bump github.com/urfave/cli/v3 from 3.3.8 to 3.4.1 Bumps [github.com/urfave/cli/v3](https://github.com/urfave/cli) from 3.3.8 to 3.4.1. - [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.3.8...v3.4.1) --- updated-dependencies: - dependency-name: github.com/urfave/cli/v3 dependency-version: 3.4.1 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 +- vendor/github.com/urfave/cli/v3/command.go | 6 +- .../github.com/urfave/cli/v3/command_run.go | 12 +- vendor/github.com/urfave/cli/v3/errors.go | 11 +- vendor/github.com/urfave/cli/v3/fish.go | 2 +- .../urfave/cli/v3/flag_slice_base.go | 15 +- .../urfave/cli/v3/godoc-current.txt | 139 +++++++++++------- vendor/github.com/urfave/cli/v3/help.go | 86 ++++++----- vendor/modules.txt | 2 +- 10 files changed, 177 insertions(+), 102 deletions(-) diff --git a/go.mod b/go.mod index 1206bb2c..fc1c5c23 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( github.com/obalunenko/version v1.3.1 github.com/savioxavier/termlink v1.4.3 github.com/stretchr/testify v1.10.0 - github.com/urfave/cli/v3 v3.3.8 + github.com/urfave/cli/v3 v3.4.1 ) require ( diff --git a/go.sum b/go.sum index 5d75c530..d425e68e 100644 --- a/go.sum +++ b/go.sum @@ -29,8 +29,8 @@ github.com/savioxavier/termlink v1.4.3 h1:Gh6vrG7jSn21cRiYdQqFXYcdXfM+Fg14aG487J github.com/savioxavier/termlink v1.4.3/go.mod h1:5T5ePUlWbxCHIwyF8/Ez1qufOoGM89RCg9NvG+3G3gc= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -github.com/urfave/cli/v3 v3.3.8 h1:BzolUExliMdet9NlJ/u4m5vHSotJ3PzEqSAZ1oPMa/E= -github.com/urfave/cli/v3 v3.3.8/go.mod h1:FJSKtM/9AiiTOJL4fJ6TbMUkxBXn7GO9guZqoZtpYpo= +github.com/urfave/cli/v3 v3.4.1 h1:1M9UOCy5bLmGnuu1yn3t3CB4rG79Rtoxuv1sPhnm6qM= +github.com/urfave/cli/v3 v3.4.1/go.mod h1:FJSKtM/9AiiTOJL4fJ6TbMUkxBXn7GO9guZqoZtpYpo= golang.org/x/exp v0.0.0-20250218142911-aa4b98e5adaa h1:t2QcU6V556bFjYgu4L6C+6VrCPyJZ+eyRsABUPs1mz4= golang.org/x/exp v0.0.0-20250218142911-aa4b98e5adaa/go.mod h1:BHOTPb3L19zxehTsLoJXVaTktb06DFgmdW6Wb9s8jqk= golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= diff --git a/vendor/github.com/urfave/cli/v3/command.go b/vendor/github.com/urfave/cli/v3/command.go index 541081a5..d7b05637 100644 --- a/vendor/github.com/urfave/cli/v3/command.go +++ b/vendor/github.com/urfave/cli/v3/command.go @@ -85,9 +85,9 @@ type Command struct { Writer io.Writer `json:"-"` // ErrWriter writes error output ErrWriter io.Writer `json:"-"` - // ExitErrHandler processes any error encountered while running an App before - // it is returned to the caller. If no function is provided, HandleExitCoder - // is used as the default behavior. + // ExitErrHandler processes any error encountered while running a Command before it is + // returned to the caller. If no function is provided, HandleExitCoder is used as the + // default behavior. ExitErrHandler ExitErrHandlerFunc `json:"-"` // Other custom info Metadata map[string]interface{} `json:"metadata"` diff --git a/vendor/github.com/urfave/cli/v3/command_run.go b/vendor/github.com/urfave/cli/v3/command_run.go index 24b79351..6b2abc1b 100644 --- a/vendor/github.com/urfave/cli/v3/command_run.go +++ b/vendor/github.com/urfave/cli/v3/command_run.go @@ -175,9 +175,9 @@ func (cmd *Command) run(ctx context.Context, osArgs []string) (_ context.Context } if !cmd.hideHelp() { if cmd.parent == nil { - tracef("running ShowAppHelp") - if err := ShowAppHelp(cmd); err != nil { - tracef("SILENTLY IGNORING ERROR running ShowAppHelp %[1]v (cmd=%[2]q)", err, cmd.Name) + tracef("running ShowRootCommandHelp") + if err := ShowRootCommandHelp(cmd); err != nil { + tracef("SILENTLY IGNORING ERROR running ShowRootCommandHelp %[1]v (cmd=%[2]q)", err, cmd.Name) } } else { tracef("running ShowCommandHelp with %[1]q", cmd.Name) @@ -314,7 +314,11 @@ func (cmd *Command) run(ctx context.Context, osArgs []string) (_ context.Context if err := cmd.checkAllRequiredFlags(); err != nil { cmd.isInError = true - _ = ShowSubcommandHelp(cmd) + if cmd.OnUsageError != nil { + err = cmd.OnUsageError(ctx, cmd, err, cmd.parent != nil) + } else { + _ = ShowSubcommandHelp(cmd) + } return ctx, err } diff --git a/vendor/github.com/urfave/cli/v3/errors.go b/vendor/github.com/urfave/cli/v3/errors.go index 6b377f10..a1188e73 100644 --- a/vendor/github.com/urfave/cli/v3/errors.go +++ b/vendor/github.com/urfave/cli/v3/errors.go @@ -92,8 +92,7 @@ type ErrorFormatter interface { Format(s fmt.State, verb rune) } -// ExitCoder is the interface checked by `App` and `Command` for a custom exit -// code +// ExitCoder is the interface checked by `Command` for a custom exit code. type ExitCoder interface { error ExitCode() int @@ -107,11 +106,11 @@ type exitError struct { // Exit wraps a message and exit code into an error, which by default is // handled with a call to os.Exit during default error handling. // -// This is the simplest way to trigger a non-zero exit code for an App without +// This is the simplest way to trigger a non-zero exit code for a Command without // having to call os.Exit manually. During testing, this behavior can be avoided -// by overriding the ExitErrHandler function on an App or the package-global +// by overriding the ExitErrHandler function on a Command or the package-global // OsExiter function. -func Exit(message interface{}, exitCode int) ExitCoder { +func Exit(message any, exitCode int) ExitCoder { var err error switch e := message.(type) { @@ -144,7 +143,7 @@ func (ee *exitError) ExitCode() int { // for the ExitCoder interface, and OsExiter will be called with the last exit // code found, or exit code 1 if no ExitCoder is found. // -// This function is the default error-handling behavior for an App. +// This function is the default error-handling behavior for a Command. func HandleExitCoder(err error) { if err == nil { return diff --git a/vendor/github.com/urfave/cli/v3/fish.go b/vendor/github.com/urfave/cli/v3/fish.go index 320dfc6c..1607f55b 100644 --- a/vendor/github.com/urfave/cli/v3/fish.go +++ b/vendor/github.com/urfave/cli/v3/fish.go @@ -8,7 +8,7 @@ import ( "text/template" ) -// ToFishCompletion creates a fish completion string for the `*App` +// ToFishCompletion creates a fish completion string for the `*Command` // The function errors if either parsing or writing of the string fails. func (cmd *Command) ToFishCompletion() (string, error) { var w bytes.Buffer diff --git a/vendor/github.com/urfave/cli/v3/flag_slice_base.go b/vendor/github.com/urfave/cli/v3/flag_slice_base.go index b97c4ff4..3e7b049e 100644 --- a/vendor/github.com/urfave/cli/v3/flag_slice_base.go +++ b/vendor/github.com/urfave/cli/v3/flag_slice_base.go @@ -47,8 +47,21 @@ func (i *SliceBase[T, C, VC]) Set(value string) error { return nil } + trimSpace := true + // hack. How do we know if we should trim spaces? + // it makes sense only for string slice flags which have + // an option to not trim spaces. So by default we trim spaces + // otherwise we let the underlying value type handle it. + var t T + if reflect.TypeOf(t).Kind() == reflect.String { + trimSpace = false + } + for _, s := range flagSplitMultiValues(value) { - if err := i.value.Set(strings.TrimSpace(s)); err != nil { + if trimSpace { + s = strings.TrimSpace(s) + } + if err := i.value.Set(s); err != nil { return err } *i.slice = append(*i.slice, i.value.Get().(T)) diff --git a/vendor/github.com/urfave/cli/v3/godoc-current.txt b/vendor/github.com/urfave/cli/v3/godoc-current.txt index edd42feb..bf43768c 100644 --- a/vendor/github.com/urfave/cli/v3/godoc-current.txt +++ b/vendor/github.com/urfave/cli/v3/godoc-current.txt @@ -79,6 +79,10 @@ GLOBAL OPTIONS:{{template "visiblePersistentFlagTemplate" .}}{{end}} uses text/template to render templates. You can render custom help text by setting this variable. +var DefaultAppComplete = DefaultRootCommandComplete + DefaultAppComplete is a backward-compatible name for + DefaultRootCommandComplete. + var DefaultInverseBoolPrefix = "no-" var ErrWriter io.Writer = os.Stderr ErrWriter is used to write errors to the user. This can be anything @@ -131,6 +135,21 @@ COPYRIGHT: cli.go uses text/template to render templates. You can render custom help text by setting this variable. +var ShowAppHelp = ShowRootCommandHelp + ShowAppHelp is a backward-compatible name for ShowRootCommandHelp. + +var ShowAppHelpAndExit = ShowRootCommandHelpAndExit + ShowAppHelpAndExit is a backward-compatible name for ShowRootCommandHelp. + +var ShowCommandHelp = DefaultShowCommandHelp + ShowCommandHelp prints help for the given command + +var ShowRootCommandHelp = DefaultShowRootCommandHelp + ShowRootCommandHelp is an action that displays help for the root command. + +var ShowSubcommandHelp = DefaultShowSubcommandHelp + ShowSubcommandHelp prints help for the given subcommand + var SubcommandHelpTemplate = `NAME: {{template "helpNameTemplate" .}} @@ -153,37 +172,40 @@ OPTIONS:{{template "visibleFlagTemplate" .}}{{end}} cli.go uses text/template to render templates. You can render custom help text by setting this variable. -var VersionPrinter = printVersion - VersionPrinter prints the version for the App +var VersionPrinter = DefaultPrintVersion + VersionPrinter prints the version for the root Command. -var HelpPrinter helpPrinter = printHelp - HelpPrinter is a function that writes the help output. If not set - explicitly, this calls HelpPrinterCustom using only the default template - functions. - If custom logic for printing help is required, this function can be - overridden. If the ExtraInfo field is defined on an App, this function - should not be modified, as HelpPrinterCustom will be used directly in order - to capture the extra information. +FUNCTIONS -var HelpPrinterCustom helpPrinterCustom = printHelpCustom - HelpPrinterCustom is a function that writes the help output. It is used as - the default implementation of HelpPrinter, and may be called directly if the - ExtraInfo field is set on an App. +func DefaultCompleteWithFlags(ctx context.Context, cmd *Command) +func DefaultPrintHelp(out io.Writer, templ string, data any) + DefaultPrintHelp is the default implementation of HelpPrinter. - In the default implementation, if the customFuncs argument contains a - "wrapAt" key, which is a function which takes no arguments and returns an - int, this int value will be used to produce a "wrap" function used by the - default template to wrap long lines. +func DefaultPrintHelpCustom(out io.Writer, templ string, data any, customFuncs map[string]any) + DefaultPrintHelpCustom is the default implementation of HelpPrinterCustom. + The customFuncs map will be combined with a default template.FuncMap to + allow using arbitrary functions in template rendering. -FUNCTIONS +func DefaultPrintVersion(cmd *Command) + DefaultPrintVersion is the default implementation of VersionPrinter. -func DefaultAppComplete(ctx context.Context, cmd *Command) - DefaultAppComplete prints the list of subcommands as the default app - completion method +func DefaultRootCommandComplete(ctx context.Context, cmd *Command) + DefaultRootCommandComplete prints the list of subcommands as the default + completion method. + +func DefaultShowCommandHelp(ctx context.Context, cmd *Command, commandName string) error + DefaultShowCommandHelp is the default implementation of ShowCommandHelp. + +func DefaultShowRootCommandHelp(cmd *Command) error + DefaultShowRootCommandHelp is the default implementation of + ShowRootCommandHelp. + +func DefaultShowSubcommandHelp(cmd *Command) error + DefaultShowSubcommandHelp is the default implementation of + ShowSubcommandHelp. -func DefaultCompleteWithFlags(ctx context.Context, cmd *Command) func FlagNames(name string, aliases []string) []string func HandleExitCoder(err error) HandleExitCoder handles errors implementing ExitCoder by printing their @@ -193,30 +215,22 @@ func HandleExitCoder(err error) for the ExitCoder interface, and OsExiter will be called with the last exit code found, or exit code 1 if no ExitCoder is found. - This function is the default error-handling behavior for an App. - -func ShowAppHelp(cmd *Command) error - ShowAppHelp is an action that displays the help. - -func ShowAppHelpAndExit(cmd *Command, exitCode int) - ShowAppHelpAndExit - Prints the list of subcommands for the app and exits - with exit code. - -func ShowCommandHelp(ctx context.Context, cmd *Command, commandName string) error - ShowCommandHelp prints help for the given command + This function is the default error-handling behavior for a Command. func ShowCommandHelpAndExit(ctx context.Context, cmd *Command, command string, code int) - ShowCommandHelpAndExit - exits with code after showing help + ShowCommandHelpAndExit exits with code after showing help via + ShowCommandHelp. -func ShowSubcommandHelp(cmd *Command) error - ShowSubcommandHelp prints help for the given subcommand +func ShowRootCommandHelpAndExit(cmd *Command, exitCode int) + ShowRootCommandHelpAndExit prints the list of subcommands and exits with + exit code. func ShowSubcommandHelpAndExit(cmd *Command, exitCode int) - ShowSubcommandHelpAndExit - Prints help for the given subcommand and exits - with exit code. + ShowSubcommandHelpAndExit prints help for the given subcommand via + ShowSubcommandHelp and exits with exit code. func ShowVersion(cmd *Command) - ShowVersion prints the version number of the App + ShowVersion prints the version number of the root Command. TYPES @@ -472,9 +486,9 @@ type Command struct { Writer io.Writer `json:"-"` // ErrWriter writes error output ErrWriter io.Writer `json:"-"` - // ExitErrHandler processes any error encountered while running an App before - // it is returned to the caller. If no function is provided, HandleExitCoder - // is used as the default behavior. + // ExitErrHandler processes any error encountered while running a Command before it is + // returned to the caller. If no function is provided, HandleExitCoder is used as the + // default behavior. ExitErrHandler ExitErrHandlerFunc `json:"-"` // Other custom info Metadata map[string]interface{} `json:"metadata"` @@ -687,7 +701,7 @@ func (c *Command) TimestampArg(name string) time.Time func (c *Command) TimestampArgs(name string) []time.Time func (cmd *Command) ToFishCompletion() (string, error) - ToFishCompletion creates a fish completion string for the `*App` The + ToFishCompletion creates a fish completion string for the `*Command` The function errors if either parsing or writing of the string fails. func (cmd *Command) Uint(name string) uint @@ -847,16 +861,15 @@ type ExitCoder interface { error ExitCode() int } - ExitCoder is the interface checked by `App` and `Command` for a custom exit - code + ExitCoder is the interface checked by `Command` for a custom exit code. -func Exit(message interface{}, exitCode int) ExitCoder +func Exit(message any, exitCode int) ExitCoder Exit wraps a message and exit code into an error, which by default is handled with a call to os.Exit during default error handling. - This is the simplest way to trigger a non-zero exit code for an App - without having to call os.Exit manually. During testing, this behavior - can be avoided by overriding the ExitErrHandler function on an App or the + This is the simplest way to trigger a non-zero exit code for a Command + without having to call os.Exit manually. During testing, this behavior can + be avoided by overriding the ExitErrHandler function on a Command or the package-global OsExiter function. type ExitErrHandlerFunc func(context.Context, *Command, error) @@ -1093,6 +1106,32 @@ type FloatSliceFlag = FlagBase[[]float64, NoConfig, FloatSlice] type GenericFlag = FlagBase[Value, NoConfig, genericValue] +type HelpPrinterCustomFunc func(w io.Writer, templ string, data any, customFunc map[string]any) + Prints help for the Command with custom template function. + +var HelpPrinterCustom HelpPrinterCustomFunc = DefaultPrintHelpCustom + HelpPrinterCustom is a function that writes the help output. It is used as + the default implementation of HelpPrinter, and may be called directly if the + ExtraInfo field is set on a Command. + + In the default implementation, if the customFuncs argument contains a + "wrapAt" key, which is a function which takes no arguments and returns an + int, this int value will be used to produce a "wrap" function used by the + default template to wrap long lines. + +type HelpPrinterFunc func(w io.Writer, templ string, data any) + HelpPrinterFunc prints help for the Command. + +var HelpPrinter HelpPrinterFunc = DefaultPrintHelp + HelpPrinter is a function that writes the help output. If not set + explicitly, this calls HelpPrinterCustom using only the default template + functions. + + If custom logic for printing help is required, this function can be + overridden. If the ExtraInfo field is defined on a Command, this function + should not be modified, as HelpPrinterCustom will be used directly in order + to capture the extra information. + type Int16Arg = ArgumentBase[int16, IntegerConfig, intValue[int16]] type Int16Args = ArgumentsBase[int16, IntegerConfig, intValue[int16]] diff --git a/vendor/github.com/urfave/cli/v3/help.go b/vendor/github.com/urfave/cli/v3/help.go index c039a5d0..028fbb5d 100644 --- a/vendor/github.com/urfave/cli/v3/help.go +++ b/vendor/github.com/urfave/cli/v3/help.go @@ -16,33 +16,45 @@ const ( helpAlias = "h" ) -// Prints help for the App or Command -type helpPrinter func(w io.Writer, templ string, data interface{}) +// HelpPrinterFunc prints help for the Command. +type HelpPrinterFunc func(w io.Writer, templ string, data any) -// Prints help for the App or Command with custom template function. -type helpPrinterCustom func(w io.Writer, templ string, data interface{}, customFunc map[string]interface{}) +// Prints help for the Command with custom template function. +type HelpPrinterCustomFunc func(w io.Writer, templ string, data any, customFunc map[string]any) // HelpPrinter is a function that writes the help output. If not set explicitly, // this calls HelpPrinterCustom using only the default template functions. // // If custom logic for printing help is required, this function can be -// overridden. If the ExtraInfo field is defined on an App, this function +// overridden. If the ExtraInfo field is defined on a Command, this function // should not be modified, as HelpPrinterCustom will be used directly in order // to capture the extra information. -var HelpPrinter helpPrinter = printHelp +var HelpPrinter HelpPrinterFunc = DefaultPrintHelp // HelpPrinterCustom is a function that writes the help output. It is used as // the default implementation of HelpPrinter, and may be called directly if -// the ExtraInfo field is set on an App. +// the ExtraInfo field is set on a Command. // // In the default implementation, if the customFuncs argument contains a // "wrapAt" key, which is a function which takes no arguments and returns // an int, this int value will be used to produce a "wrap" function used // by the default template to wrap long lines. -var HelpPrinterCustom helpPrinterCustom = printHelpCustom +var HelpPrinterCustom HelpPrinterCustomFunc = DefaultPrintHelpCustom -// VersionPrinter prints the version for the App -var VersionPrinter = printVersion +// VersionPrinter prints the version for the root Command. +var VersionPrinter = DefaultPrintVersion + +// ShowRootCommandHelp is an action that displays help for the root command. +var ShowRootCommandHelp = DefaultShowRootCommandHelp + +// ShowAppHelp is a backward-compatible name for ShowRootCommandHelp. +var ShowAppHelp = ShowRootCommandHelp + +// ShowCommandHelp prints help for the given command +var ShowCommandHelp = DefaultShowCommandHelp + +// ShowSubcommandHelp prints help for the given subcommand +var ShowSubcommandHelp = DefaultShowSubcommandHelp func buildHelpCommand(withAction bool) *Command { cmd := &Command{ @@ -100,8 +112,8 @@ func helpCommandAction(ctx context.Context, cmd *Command) error { // Special case when running help on main app itself as opposed to individual // commands/subcommands if cmd.parent == nil { - tracef("returning ShowAppHelp") - _ = ShowAppHelp(cmd) + tracef("returning ShowRootCommandHelp") + _ = ShowRootCommandHelp(cmd) return nil } @@ -124,14 +136,17 @@ func helpCommandAction(ctx context.Context, cmd *Command) error { return ShowSubcommandHelp(cmd) } -// ShowAppHelpAndExit - Prints the list of subcommands for the app and exits with exit code. -func ShowAppHelpAndExit(cmd *Command, exitCode int) { - _ = ShowAppHelp(cmd) - os.Exit(exitCode) +// ShowRootCommandHelpAndExit prints the list of subcommands and exits with exit code. +func ShowRootCommandHelpAndExit(cmd *Command, exitCode int) { + _ = ShowRootCommandHelp(cmd) + OsExiter(exitCode) } -// ShowAppHelp is an action that displays the help. -func ShowAppHelp(cmd *Command) error { +// ShowAppHelpAndExit is a backward-compatible name for ShowRootCommandHelp. +var ShowAppHelpAndExit = ShowRootCommandHelpAndExit + +// DefaultShowRootCommandHelp is the default implementation of ShowRootCommandHelp. +func DefaultShowRootCommandHelp(cmd *Command) error { tmpl := cmd.CustomRootCommandHelpTemplate if tmpl == "" { tracef("using RootCommandHelpTemplate") @@ -154,11 +169,14 @@ func ShowAppHelp(cmd *Command) error { return nil } -// DefaultAppComplete prints the list of subcommands as the default app completion method -func DefaultAppComplete(ctx context.Context, cmd *Command) { +// DefaultRootCommandComplete prints the list of subcommands as the default completion method. +func DefaultRootCommandComplete(ctx context.Context, cmd *Command) { DefaultCompleteWithFlags(ctx, cmd) } +// DefaultAppComplete is a backward-compatible name for DefaultRootCommandComplete. +var DefaultAppComplete = DefaultRootCommandComplete + func printCommandSuggestions(commands []*Command, writer io.Writer) { for _, command := range commands { if command.Hidden { @@ -264,14 +282,14 @@ func DefaultCompleteWithFlags(ctx context.Context, cmd *Command) { } } -// ShowCommandHelpAndExit - exits with code after showing help +// ShowCommandHelpAndExit exits with code after showing help via ShowCommandHelp. func ShowCommandHelpAndExit(ctx context.Context, cmd *Command, command string, code int) { _ = ShowCommandHelp(ctx, cmd, command) - os.Exit(code) + OsExiter(code) } -// ShowCommandHelp prints help for the given command -func ShowCommandHelp(ctx context.Context, cmd *Command, commandName string) error { +// DefaultShowCommandHelp is the default implementation of ShowCommandHelp. +func DefaultShowCommandHelp(ctx context.Context, cmd *Command, commandName string) error { for _, subCmd := range cmd.Commands { if !subCmd.HasName(commandName) { continue @@ -316,25 +334,26 @@ func ShowCommandHelp(ctx context.Context, cmd *Command, commandName string) erro return nil } -// ShowSubcommandHelpAndExit - Prints help for the given subcommand and exits with exit code. +// ShowSubcommandHelpAndExit prints help for the given subcommand via ShowSubcommandHelp and exits with exit code. func ShowSubcommandHelpAndExit(cmd *Command, exitCode int) { _ = ShowSubcommandHelp(cmd) - os.Exit(exitCode) + OsExiter(exitCode) } -// ShowSubcommandHelp prints help for the given subcommand -func ShowSubcommandHelp(cmd *Command) error { +// DefaultShowSubcommandHelp is the default implementation of ShowSubcommandHelp. +func DefaultShowSubcommandHelp(cmd *Command) error { HelpPrinter(cmd.Root().Writer, SubcommandHelpTemplate, cmd) return nil } -// ShowVersion prints the version number of the App +// ShowVersion prints the version number of the root Command. func ShowVersion(cmd *Command) { tracef("showing version via VersionPrinter (cmd=%[1]q)", cmd.Name) VersionPrinter(cmd) } -func printVersion(cmd *Command) { +// DefaultPrintVersion is the default implementation of VersionPrinter. +func DefaultPrintVersion(cmd *Command) { _, _ = fmt.Fprintf(cmd.Root().Writer, "%v version %v\n", cmd.Name, cmd.Version) } @@ -350,11 +369,11 @@ func handleTemplateError(err error) { } } -// printHelpCustom is the default implementation of HelpPrinterCustom. +// DefaultPrintHelpCustom is the default implementation of HelpPrinterCustom. // // The customFuncs map will be combined with a default template.FuncMap to // allow using arbitrary functions in template rendering. -func printHelpCustom(out io.Writer, templ string, data interface{}, customFuncs map[string]interface{}) { +func DefaultPrintHelpCustom(out io.Writer, templ string, data any, customFuncs map[string]any) { const maxLineLength = 10000 tracef("building default funcMap") @@ -443,7 +462,8 @@ func printHelpCustom(out io.Writer, templ string, data interface{}, customFuncs _ = w.Flush() } -func printHelp(out io.Writer, templ string, data interface{}) { +// DefaultPrintHelp is the default implementation of HelpPrinter. +func DefaultPrintHelp(out io.Writer, templ string, data any) { HelpPrinterCustom(out, templ, data, nil) } diff --git a/vendor/modules.txt b/vendor/modules.txt index 6576e061..4035fc03 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -43,7 +43,7 @@ github.com/savioxavier/termlink github.com/stretchr/testify/assert github.com/stretchr/testify/assert/yaml github.com/stretchr/testify/require -# github.com/urfave/cli/v3 v3.3.8 +# github.com/urfave/cli/v3 v3.4.1 ## explicit; go 1.22 github.com/urfave/cli/v3 # golang.org/x/exp v0.0.0-20250218142911-aa4b98e5adaa