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

Added AutoHelp and AutoVersion properties to control adding of implicit 'help' and 'version' options/verbs #256

Merged
merged 2 commits into from
Dec 18, 2018

Conversation

Athari
Copy link
Contributor

@Athari Athari commented Mar 20, 2018

Covers #87 and #200.

@Athari Athari changed the title Added AutoHelp and AutoVersion properties to control adding of implicit 'help' and 'version' options/verbs. Added AutoHelp and AutoVersion properties to control adding of implicit 'help' and 'version' options/verbs Mar 20, 2018
@nemec
Copy link
Contributor

nemec commented Mar 26, 2018

I think this solves the issues nicely. Can you add a few tests to help us prevent regressions? I think the following should cover things, but if you think of any other scenarios feel free to include them:

  1. AutoHelp = false and invoking --help returns an error.
  2. AutoVersion = false and invoking --version returns an error.
  3. AutoHelp = false, a flag for --help added manually by the user to the Options class, and it can be invoked successfully.
  4. AutoVersion = false, a flag for --version added manually by the user to the Options class, and it can be invoked successfully.

@Athari
Copy link
Contributor Author

Athari commented Mar 28, 2018

@nemec Added tests.

@brphelps
Copy link

brphelps commented Jul 2, 2018

@nemec Can it be merge time?

@ericnewton76 ericnewton76 changed the base branch from master to develop December 18, 2018 00:34
@ericnewton76 ericnewton76 merged commit 6a781d1 into commandlineparser:develop Dec 18, 2018
@moh-hassan
Copy link
Collaborator

@Athari
Please, can you add a wiki documentation page to explain how to use the new feature of AutoHelp/ AutoVersion with Code examples.
There is a confusion and misuse of this feature.

@moh-hassan
Copy link
Collaborator

@Athari
Please can you confirm if this feature
[ ] can enable developer to provide his own help/ version text.
[ ] show/ hide help/version.

Why setting exist in both parserSetting and help text.
There is a misunderstanding in using this feature.

CC / @rmunn

@Athari
Copy link
Contributor Author

Athari commented May 21, 2020

@moh-hassan
Looks like I've messed up something. I did have problems propagating options, but instead of introducing heavier changes just added two more arguments here and there. But the main reason for me missing the bugs is likely correctly identified by @x789:

#256 describes the possibility to automatically add a 'help' and 'version' verb/option to the parser. This works as far as only the parser is considered. I think when #256 was integrated, it was not considered that there will also be applications without 'help' and 'version' (see #294, #414 and #455).

What others have commented on the #461 is correct: I'd expect AutoHelp=false and AutoVersion=false to allow both providing own commands and not providing any (see comment above).

Anyway, what's the current status? Wasn't #461 closed?

P.S. Frankly, I consider this library a lost cause, mostly because the original developer went crazy with the pseudo-functional style and made a mess of both the public API (tons of callbacks) and the implementation ("maybe" and other reinvented wheels with very poor implementations), while completely ignoring good old code smells like methods with tons of arguments, and I doubt anybody is going to spend time refactoring the whole codebase and making massive backwards compatbility breaking changes to public API yet again, even if it's allowed by the current maintainers.

@henon
Copy link

henon commented Sep 12, 2021

Just giving a heads up. It is possible to override --help and --version now if you set AutoHelp and AutoVersion to false in the parser config.

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.

6 participants