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 HelpFlag as part of VisibleFlags. #636

Closed
wants to merge 1 commit into from

Conversation

harshavardhana
Copy link
Contributor

Additionally also allow help command to be hidden

Additionally also allow help command to be hidden
@harshavardhana
Copy link
Contributor Author

Any feedback on this @jszwedko ?

@jszwedko
Copy link
Contributor

Hi @harshavardhana,

Apologies for the delay in review. Do you mind adding some additional details about the what this change is enabling?

It also appears to alter the existing interface by changing the behavior of the HideHelp field. If that was intentional, we may need to retarget this to the v2 branch to avoid breaking compatibility.

@wking
Copy link
Contributor

wking commented Oct 14, 2017

Part of what this PR is doing is splitting HideHelp into separate booleans for the command and option. That would let us address #222 and avoid things like listing:

USAGE:
    [global options] command [command options] [arguments...]

for an app whose only command is help where the meat of the app is in the app-level Run. With this PR, setting HideHelpCommand but not HideHelp will give you:

USAGE:
    [global options] [arguments...]

I agree that there are backwards-compat concerns, but think we can address them with a slight tweak. Instead of re-purposing HideHelp, I'd deprecate it (to be removed in v2) and add both HideHelpCommand and HideHelpFlag. Then you could hide if the specific property was set or the deprecated generic property was set. That covers all cases except:

  1. Alice's new code sets HideHelpFlag true, and hands the App off to Bob's code.
  2. Bob's old code sets HideHelp false, because it wants to ensure that the --help flag is visible.

Bob's usecase would work now (because the only way Alice could have disabled --help is via HideHelp), but Bob's usecase would break with my proposed approach. Still, I think that passing App and Command instances around with different parties having different opinions on whether --help should be displayed is unlikely. In most cases, these are only used locally within a single repository.

@jszwedko
Copy link
Contributor

@wking aha, I see, thank you for providing additional context. I like your idea of splitting out the flags and deprecating HideHelp.

@meatballhat meatballhat self-assigned this Feb 24, 2018
@devmattrick
Copy link

Sorry for the ping, but are still plans to implement this?

@AkihiroSuda
Copy link
Contributor

Any chance to get this reopened?

@coilysiren
Copy link
Member

@AkihiroSuda @devmattrick either of you are free to open a new PR! Please create an associated issue first though.

@AkihiroSuda
Copy link
Contributor

Will try, #523 seems the existing issue ticket that covers this.

AkihiroSuda added a commit to AkihiroSuda/urfave-cli that referenced this pull request 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 urfave#523
Replace urfave#636

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
@AkihiroSuda AkihiroSuda mentioned this pull request Mar 5, 2020
1 task
@AkihiroSuda
Copy link
Contributor

PR: #1083

AkihiroSuda added a commit to AkihiroSuda/urfave-cli that referenced this pull request 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 urfave#523
Replace urfave#636

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
AkihiroSuda added a commit to AkihiroSuda/urfave-cli that referenced this pull request 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 urfave#523
Replace urfave#636

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
AkihiroSuda added a commit to AkihiroSuda/urfave-cli that referenced this pull request 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 urfave#523
Replace urfave#636

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
AkihiroSuda added a commit to AkihiroSuda/urfave-cli that referenced this pull request 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 urfave#523
Replace urfave#636

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
AkihiroSuda added a commit to AkihiroSuda/urfave-cli that referenced this pull request 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 urfave#523
Replace urfave#636

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
AkihiroSuda added a commit to AkihiroSuda/urfave-cli that referenced this pull request 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 urfave#523
Replace urfave#636

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
AkihiroSuda added a commit to AkihiroSuda/urfave-cli that referenced this pull request Mar 6, 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 urfave#523
Replace urfave#636

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
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.

7 participants