Skip to content

Conversation

@Maks1mS
Copy link
Contributor

@Maks1mS Maks1mS commented Sep 2, 2025

What type of PR is this?

  • feature

What this PR does / why we need it:

This PR introduces the ability to override the usage text of the default help command.


In v2, I implemented in my app translations for the help command by overriding the usage text after app.Setup():

func Localize(app *cli.App) {
	app.Setup()
	// ...
	for _, cmd := range app.Commands {
		if cmd.Name == "help" {
			cmd.Usage = gotext.Get("Shows a list of commands or help for one command")
		}
	}
}

However, v3 removed the cli.App and Setup method, making this approach impossible.
This PR adds a way to customize help command text, enabling use cases like localization.

Which issue(s) this PR fixes:

N/A

Release Notes

Feature: add ability to override usage text of default help command

@Maks1mS Maks1mS requested a review from a team as a code owner September 2, 2025 04:35
@Maks1mS Maks1mS force-pushed the custom-usage-help branch 2 times, most recently from ccf2971 to 3de689e Compare September 2, 2025 06:05
@dearchap
Copy link
Contributor

@Maks1mS can you fix the gofmt error check ?

@dearchap dearchap merged commit 41334d4 into urfave:main Nov 11, 2025
9 checks passed
@GwynethLlewelyn
Copy link

Cool! What exactly needs to be called (and how) to do the override?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants