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

Add HideHelpCommand #1083

Merged
merged 1 commit into from Mar 6, 2020
Merged

Add HideHelpCommand #1083

merged 1 commit into from Mar 6, 2020

Conversation

@AkihiroSuda
Copy link
Contributor

AkihiroSuda commented Mar 5, 2020

What type of PR is this?

  • feature

What this PR does / why we need it:

While HideHelp hides both help command and --help flag, HideHelpCommand
only hides help command and leave --help flag as-is.

The behavior of HideHelp is untouched in this commit.

Which issue(s) this PR fixes:

Fixes #523
Replaces #636

Testing

go test -v -run TestHideHelpCommand

Release Notes

Added `HideHelpCommand`. While `HideHelp` hides both `help` command and `--help` flag, `HideHelpCommand` only hides `help` command and leave `--help` flag as-is.
@codecov
Copy link

codecov bot commented Mar 5, 2020

Codecov Report

Merging #1083 into master will increase coverage by 0.27%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1083      +/-   ##
==========================================
+ Coverage   72.91%   73.18%   +0.27%     
==========================================
  Files          33       33              
  Lines        2481     2480       -1     
==========================================
+ Hits         1809     1815       +6     
+ Misses        565      559       -6     
+ Partials      107      106       -1
Impacted Files Coverage Δ
flag.go 86.39% <ø> (+0.16%) ⬆️
app.go 81.22% <100%> (+2.5%) ⬆️
command.go 82.83% <100%> (+0.12%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1b7e4e0...75e7c52. Read the comment docs.

@AkihiroSuda AkihiroSuda force-pushed the AkihiroSuda:hide-help-command branch 2 times, most recently from 2426f97 to 3e5678c Mar 5, 2020
@AkihiroSuda
Copy link
Contributor Author

AkihiroSuda commented Mar 5, 2020

Any chance to get v2.2.0 released soon with this?

Copy link
Member

rliebz left a comment

Looks good, thanks for pulling this together.

I think the only thing left is getting the coverage check passing.

app.go Outdated Show resolved Hide resolved
@AkihiroSuda AkihiroSuda force-pushed the AkihiroSuda:hide-help-command branch 4 times, most recently from 4604362 to 2129edf Mar 5, 2020
While `HideHelp` hides both `help` command and `--help` flag, `HideHelpCommand`
only hides `help` command and leave `--help` flag as-is.

The behavior of `HideHelp` is untouched in this commit.

Fix #523
Replace #636

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
@AkihiroSuda AkihiroSuda force-pushed the AkihiroSuda:hide-help-command branch from 2129edf to 75e7c52 Mar 6, 2020
// append help to commands
if len(a.Commands) > 0 {
if a.Command(helpCommand.Name) == nil && !a.HideHelp {
a.appendCommand(helpCommand)

if HelpFlag != nil {
a.appendFlag(HelpFlag)
}
}
}
Comment on lines -333 to -342

This comment has been minimized.

@lynncyrin

lynncyrin Mar 6, 2020 Member

(blocking question) this code is being removed because it was duplicated in Setup above, yeah?

This comment has been minimized.

@AkihiroSuda

AkihiroSuda Mar 6, 2020 Author Contributor

Yes, and because of the duplication, this code path was not executed and could not be covered with tests: #1083 (comment)

This comment has been minimized.

@lynncyrin

lynncyrin Mar 6, 2020 Member

Nice find!

@lynncyrin
Copy link
Member

lynncyrin commented Mar 6, 2020

Any chance to get v2.2.0 released soon with this?

I can write up the release notes this weekend probs

@lynncyrin lynncyrin requested a review from rliebz Mar 6, 2020
@rliebz
rliebz approved these changes Mar 6, 2020
@rliebz rliebz merged commit d648edd into urfave:master Mar 6, 2020
12 checks passed
12 checks passed
ubuntu-latest @ Go 1.11
Details
ubuntu-latest @ Go 1.12
Details
ubuntu-latest @ Go 1.13
Details
macos-latest @ Go 1.11
Details
macos-latest @ Go 1.12
Details
macos-latest @ Go 1.13
Details
windows-latest @ Go 1.11
Details
windows-latest @ Go 1.12
Details
windows-latest @ Go 1.13
Details
test-docs
Details
codecov/patch 100% of diff hit (target 72.91%)
Details
codecov/project 73.18% (+0.27%) compared to 1b7e4e0
Details
@lynncyrin lynncyrin mentioned this pull request Mar 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

3 participants
You can’t perform that action at this time.