CLIUtils / CLI11

CLI11 is a command line parser for C++11 and beyond that provides a rich feature set with a simple and intuitive interface.
https://cliutils.github.io/CLI11/book/
Other
3.35k stars 350 forks source link

tristate flags not working #237

Closed JPEWdev closed 5 years ago

JPEWdev commented 5 years ago

Using a "tristate" flag does not work as described in the documentation. For example, the following code:

int r;
app.add_flag("--foo,!--no-foo", r, "foo flag");

fails to parse with the error:

terminate called after throwing an instance of 'CLI::IncorrectConstruction'
  what():  --foo,!--no-foo: Flags cannot be positional

Using the other syntax of "--foo,--no-foo{false}" also fails with the error:

terminate called after throwing an instance of 'CLI::BadNameString'
  what():  Bad long name: no-foo{false}
phlptp commented 5 years ago

Just to be sure, are you on the latest master branch? Those features were not added until after the last release so you would need to be on the latest master to use them.

I ran some tests with the latest master using both those scenarios and it runs as expected.

JPEWdev commented 5 years ago

Ah, OK. I assumed the "try online" link was for master, so when I replicated the error there I assumed it was broken. Sorry.

henryiii commented 5 years ago

"Try online" probably should list the version again, it used to. It's updated manually on Wandbox after a release.

phlptp commented 5 years ago

May also want to consider tagging features that are not in the latest release to make things a little clearer.

henryiii commented 5 years ago

I do like the way Python's docs tend to list version added. But for a readme, that would be overkill. An easy-to-remove tag for new features would be fine; probably start on the next version unless someone wants to go tag features.

Personally, I love the changelogs in software and would go there to see what's not in the latest version. :)

henryiii commented 5 years ago

I've added a construction symbol to new features in the readme, and I've added the "try 1.7" text to the try online button. At each release, we can convert 🚧 to 🆕, and 🆕 to nothing.