Skip to content

Issue#2323#2345

Open
MohitPanchariya wants to merge 6 commits into
urfave:mainfrom
MohitPanchariya:issue#2323
Open

Issue#2323#2345
MohitPanchariya wants to merge 6 commits into
urfave:mainfrom
MohitPanchariya:issue#2323

Conversation

@MohitPanchariya
Copy link
Copy Markdown
Contributor

@MohitPanchariya MohitPanchariya commented May 28, 2026

What type of PR is this?

(REQUIRED)

  • feature

What this PR does / why we need it:

(REQUIRED)

  • This PR introduces an option to include arbitrary help topics to the help message.
  • There exists a way to do this for the Root command right now, through the ExtraInfo field,
    but that requires using a custom template. Its a bit cumbersome to use custom templates from a
    users perspective just to print additional help topics.
  • Given the use case to have additional help topics seems generic, this PR changes the default
    help templates to conditionally render additional help topics.

Which issue(s) this PR fixes:

Fixes #2323

(REQUIRED)

Testing

(fill-in or delete this section)

Added unit tests to test additional help topics.

Release Notes

(REQUIRED)

The `AdditionalHelpTopics` field can be used to print arbitrary help topics, in addition to the existing
help topics, without the need for a custom help template.

@MohitPanchariya MohitPanchariya marked this pull request as ready for review May 28, 2026 19:34
@MohitPanchariya MohitPanchariya requested a review from a team as a code owner May 28, 2026 19:34
@MohitPanchariya MohitPanchariya self-assigned this May 28, 2026
Comment thread template.go

{{$key}}:
{{$value}}
{{- end}}`
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
{{- end}}`
{{end}}`

Copy link
Copy Markdown
Contributor

@dearchap dearchap left a comment

Choose a reason for hiding this comment

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

@MohitPanchariya I like this PR . Its very clean and backward compatible. However I am more worried about side effects of a special case like this. People will start adding more and more things like this throughout the template. Do you see lots of people using this or is this a one off for convenience ? Strictly speaking users can remap the template to whatever they'd like.

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.

Add a way to add additional topics to generated usage texts

2 participants