Skip to content

Default values for options not showing (getting an error following the documentation) #667

Open
@chakizimana

Description

@chakizimana

My apologies if this problem has already been addressed in a different issue.

I am using the single file edition of CLI11. I have been testing out add_option() in order to parse arguments but I am not able to output default values using the instructions in the gitbook: https://cliutils.github.io/CLI11/book/. From the documentation (this section in particular https://cliutils.github.io/CLI11/book/chapters/options.html), it is mentioned that those values are not shown by default using -h, but can be if specified by adding the optional argument true. However, this feature does not seem to work. The only way to output those values is to use the following ->capture_default_str().

For instance, if I were to have a parameter called a and be able to see their default value, this does not work:
app.add_option("-a", a, "parameter a",true);

I can only see the default value of a if I were to do this:
app.add_option("-a", a, "parameter a")->capture_default_str()

Edit: grammar error

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsAdd/update documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions