Skip to content

v2.0.0

Compare
Choose a tag to compare
@Sirraide Sirraide released this 18 Oct 23:07
· 37 commits to master since this release

New version!

Now, you can reuse the same option type to parse options multiple times. As a result, this is a breaking change that also comes with some API changes. In particular, instead of

options::parse(argc, argv);
int x = *options::get<"--my-int-option">();

write

auto opts = options::parse(argc, argv);
int x = *opts.get<"--my-int-option">();

This is mainly because, while I still don’t see much of a use case for parsing command-line options more than once in the same invocation of a program, the previous approach

  1. was technically scuffed as everything was just a bunch of global state, and
  2. could lead to errors if the same option type was defined twice, because those two types would then be... the same type, and thus share state, which led to confusing errors during testing.

Also, we have tests now, so I guess I’ll know sooner if I end up breaking something.