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

How to remove/replace option's type annotation string? #151

Closed
akowalew opened this issue Jul 27, 2018 · 3 comments
Closed

How to remove/replace option's type annotation string? #151

akowalew opened this issue Jul 27, 2018 · 3 comments

Comments

@akowalew
Copy link

akowalew commented Jul 27, 2018

Hi! First, thanks for this library, it works quite well for me!

At the moment I have one question: how to remove (or replace) annotation string near to the option?
For example, adding an option of type int prints in help something like this:

-p,--period INT

If desired type is really int, it is quite OK. Now I would like to change type of period to std::chrono::milliseconds (in general std::chrono::duration<TRep, TPeriod>). I have written needed parser to accomplish this task, modified option's target type, and now help prints me this:

-p,--period TEXT

Well, this looks a bit confusing for me. May I replace this annotation with custom one or just throw it away? E.g. -p,--period PERIOD, or just -p,--period.

@henryiii
Copy link
Collaborator

henryiii commented Jul 27, 2018

That's its type_name, and it is ->type_name("PERIOD"), or ->type_name("").

(CLI11 1.6, in 1.5 you'd have to use ->set_custom_option("PERIOD"))

@akowalew
Copy link
Author

Excellent. Thanks a lot!

@henryiii
Copy link
Collaborator

NP!

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

No branches or pull requests

2 participants