+
Skip to content

Conversation

adrian-thurston
Copy link
Contributor

@adrian-thurston adrian-thurston commented Jun 25, 2025

What type of PR is this?

  • bug

What this PR does / why we need it:

The custom help template was not getting used in subcommand help. This is called when using HideHelpCommand. Updated ShowSubcommand to use the custom template.

It's possible a minor refactor in the help display cases is needed here, but this change fixes our immediate problem.

Which issue(s) this PR fixes:

No known issue, just discovered locally.

Special notes for your reviewer:

None.

Testing

Test case for the bug added.

Release Notes

Bug fix: use the custom help template in a subcommand when in HideHelpCommand is active

The custom help template was not getting used in subcommand help. This is
called when using HideHelpCommand. Updated ShowSubcommand to use the custom
template.

It's possible a minor refactor in the help display cases is needed here, but
this change fixes our immediate problem.
@adrian-thurston adrian-thurston requested a review from a team as a code owner June 25, 2025 18:18
@adrian-thurston adrian-thurston changed the title Fix/custom help for subcommand Use the custom help template in ShowSubcommand Jun 25, 2025
@dearchap
Copy link
Contributor

@adrian-thurston the subcommand help is supposed to use the subcommand template. I think you have your logic backwards. If subcommand template is empty then it can use the main command template

@adrian-thurston
Copy link
Contributor Author

adrian-thurston commented Jul 15, 2025

@adrian-thurston the subcommand help is supposed to use the subcommand template. I think you have your logic backwards. If subcommand template is empty then it can use the main command template

@dearchap Should there be a separate customization for the subcommand help then? I'm more interested in customizing it, rather than specializing it differently between command and subcommand.

@dearchap
Copy link
Contributor

dearchap commented Aug 9, 2025

@adrian-thurston When you say customization for subcommand what do you mean ?

@dearchap dearchap added status/waiting-for-response Waiting for response from original requester area/v3 relates to / is being considered for v3 labels Aug 16, 2025
@adrian-thurston
Copy link
Contributor Author

@dearchap In V2 we would set CustomHelpTemplate on cli.Command and it would get used for prog cmd --help and prog cmd subcmd --help.

In V3 it gets used only on prog cmd --help. For subcommands it uses the default.

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

Labels

area/v3 relates to / is being considered for v3 status/waiting-for-response Waiting for response from original requester

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载