Skip to content

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

Closed

Description

@akowalew

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.

Activity

  1. henryiii commented on Jul 27, 2018

    @henryiii
    Collaborator

    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"))

  2. akowalew commented on Jul 30, 2018

    @akowalew
    Author

    Excellent. Thanks a lot!

  3. henryiii commented on Jul 30, 2018

    @henryiii
    Collaborator

    NP!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions