Skip to content

Use usage template in subcommand help#1986

Merged
dearchap merged 1 commit intov2-maintfrom
v2-use-usage-template-in-subcommand-help
Oct 14, 2024
Merged

Use usage template in subcommand help#1986
dearchap merged 1 commit intov2-maintfrom
v2-use-usage-template-in-subcommand-help

Conversation

@meatballhat
Copy link
Member

What type of PR is this?

  • bug

What this PR does / why we need it:

Use existing usage template in subcommand help to remove (confusing) difference between templates.

Which issue(s) this PR fixes:

Closes #1879

to remove (confusing) difference between templates.

Closes #1879
@meatballhat meatballhat added the area/v2 relates to / is being considered for v2 label Oct 14, 2024
@meatballhat meatballhat added this to the Release 2.x milestone Oct 14, 2024
@meatballhat meatballhat requested a review from a team as a code owner October 14, 2024 01:28
Copy link
Member

@BlackHole1 BlackHole1 left a comment

Choose a reason for hiding this comment

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

LGTM

@vimiix
Copy link
Contributor

vimiix commented Oct 14, 2024

@meatballhat Do we need to display different formats depending on whether there are subcommands?

For example, fix the templ variable in ShowSubcommandHelp function like this:

templ := SubcommandHelpTemplate
if cCtx.Command != nil {
  if cCtx.Command.CustomHelpTemplate != "" {
    templ = cCtx.Command.CustomHelpTemplate
  } else if len(cCtx.Command.VisibleCommands()) == 0 {
    templ = CommandHelpTemplate
  }
}

@meatballhat
Copy link
Member Author

@vimiix good point! I'd like to see if that logic can be part of "usageTemplate" 👀

@dearchap dearchap merged commit 50bdebf into v2-maint Oct 14, 2024
@dearchap dearchap deleted the v2-use-usage-template-in-subcommand-help branch October 14, 2024 11:42
rvagg added a commit to filecoin-project/lotus that referenced this pull request Oct 6, 2025
rvagg added a commit to filecoin-project/lotus that referenced this pull request Oct 6, 2025
)

* build(deps): bump github.com/urfave/cli/v2 from 2.27.5 to 2.27.7

Bumps [github.com/urfave/cli/v2](https://github.com/urfave/cli) from 2.27.5 to 2.27.7.
- [Release notes](https://github.com/urfave/cli/releases)
- [Changelog](https://github.com/urfave/cli/blob/main/docs/CHANGELOG.md)
- [Commits](urfave/cli@v2.27.5...v2.27.7)

---
updated-dependencies:
- dependency-name: github.com/urfave/cli/v2
  dependency-version: 2.27.7
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* fix: update cli docs (docsgen-cli)

Ref: urfave/cli#1986

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Rod Vagg <rod@vagg.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/v2 relates to / is being considered for v2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants