Skip to content

No take_last specifier for add_flag #62

@bergercookie

Description

@bergercookie

In the CLI11 tutorials it says that:

This will bind the flag -f to the boolean my_flag. After the parsing step, my_flag will be false if the flag was not found on the command line, or true if it was. By default, it will be allowed any number of times, but if you explicitly1 request ->take_last(false), it will only be allowed once; passing something like ./my_app -f -f or ./my_app -ff will throw a ParseError with a nice help description.

However, after including the CLI11.hpp file and using this kind of expression I get the error:

no member named 'take_last' in 'CLI::Option'

The expression I used is the following:

bool runSingleThread;
subcommand->add_flag("-s,--singleThread", runSingleThread, "Split execution into multiple threads")
      ->take_last(false);

Is there something I did wrong? Is this option implemented in a later version than the one I'm using?

Cheers

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