Open
Conversation
Contributor
What is the "Case 3, 5" branch? Is there a diagram? |
Author
I mean this "if" section: https://github.com/urfave/cli/blob/main/help.go#L126-L138 |
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
What this PR does / why we need it:
I was trying to customize the help in my app by setting the following to custom functions:
cli.ShowRootCommandHelpcli.ShowCommandHelpcli.ShowSubcommandHelpHowever I noticed that in the particular case of
app command helpnone of these were getting called and I was getting the builtin help. Looking in the code thehelp.helpCommandAction()function wasn't calling any of the above custom functions in the "Case 3, 5" branch and directly calledHelpPrinter()instead. So I fixed this in commit 4031d4c by making it callShowCommandHelp()with appropriate arguments.The
TestCommand_Run_SubcommandFullPathtest then started failing because it wasn't getting the[options]part of the help text (which is inusageTemplate). I fixed that in commit 27816c3 by changing the test for which template to use to check for visible commands rather than any commands. This test now matches the code that was removed in the previous commit.Then there were two test failures in:
After looking at those I came to the conclusion that the help text now getting output was more correct than before, so I fixed the expected test results to match reality in commit 159faa0. In both cases new text includes the
[options]text and aGLOBAL OPTIONSsection, which seems appropriate as they're leaf commands that can be executed directly rather needing an additional subcommand to be specified.Which issue(s) this PR fixes:
None - I didn't file a bug report, I just fixed it instead.
Testing
I ran
make testlocally.Release Notes