Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to reset the templates to the default #2229

Merged
merged 1 commit into from
Feb 6, 2025

Conversation

marckhouzam
Copy link
Collaborator

@marckhouzam marckhouzam commented Feb 2, 2025

Follow-up to #1956.

This commit allows a program to reset any of the three templates to their default behaviour, as it was possible to do before the change of #1956.

For example, one could imagine that a program could call SetUsageTemplate("{{A short help}}"), but if a particular set of arguments is passed in by the user, the program would want to reset to the default help by calling SetUsageTemplate("") (basically cancelling the previous call to SetUsageTemplate()).

This used to be possible before #1956, and this PR brings back this support.

Granted, this is a bit of a corner case, but with so many programs using Cobra, let's not make any assumptions and avoid unexpected changes.

cc @aarzilli @jpmcb

Follow-up to spf13#1956.

This commit allows a program to reset any of the tree templates to their
default behaviour, as it was possible to do before the change of spf13#1956.

Signed-off-by: Marc Khouzam <marc.khouzam@gmail.com>
@marckhouzam marckhouzam added this to the 1.9.0 milestone Feb 2, 2025
Copy link
Contributor

@aarzilli aarzilli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM -- good catch

@jpmcb jpmcb merged commit ab5cadc into spf13:main Feb 6, 2025
20 checks passed
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.

None yet

3 participants