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

If the Version string is empty, the version section should not appear in usage output #248

Closed
MartyMacGyver opened this issue Jun 25, 2015 · 7 comments · Fixed by #955
Closed

Comments

@MartyMacGyver
Copy link
Contributor

If the Version string is empty, then the version section should not be displayed at all in the usage output. Currently if the version string is empty, the usage output prints "VERSION:" followed by an empty line.

It would be up to the user to set HideVersion=true to remove the now-superfluous option when they define Version=""

(I was originally going to suggest that the default be an empty string as well, but that could have unwanted side-effects on downstream projects. Instead, one would simply empty the Version string to cause it to be hidden from the usage output, which should not have side-effects).

@MartyMacGyver
Copy link
Contributor Author

I've submitted pull request #250 to address this issue (note that this pull request contains the branch for pull request #249 as well)

@jszwedko
Copy link
Contributor

jszwedko commented Jul 1, 2015

Closed via #251; thank you!

@jszwedko jszwedko closed this as completed Jul 1, 2015
@tonglil
Copy link

tonglil commented Jan 13, 2016

How come when I use this package it still shows the version?

@MartyMacGyver
Copy link
Contributor Author

Are you seeing the VERSION: info in the help output or elsewhere?

@tonglil
Copy link

tonglil commented Jan 13, 2016

Yes, in the help output. On second look, I am assuming that PR only affects it not in the help output?

@MartyMacGyver
Copy link
Contributor Author

After getting the pointer from NewApp (e.g., "app"), did you define app.Version as ""?

@MartyMacGyver
Copy link
Contributor Author

In addition, if you don't want the option named "version" working nor displayed in the help, you should also set app.HideVersion = true (as noted in the PR above). Then -v will throw an error and -h will not show a version number nor a version global option.

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 a pull request may close this issue.

3 participants