foxpy / qc

Quad C: Custom Cruel C Crate
MIT License
4 stars 0 forks source link

argument parsing library: no way to set default argument value or make argument mandatory #10

Closed foxpy closed 3 years ago

foxpy commented 3 years ago

I propose the following solution:

Every function has a second variant, which accepts a default value - this argument is not mandatory to set because there is a default value. The original functions work as expected but they define mandatory arguments, because there is no default value.

That's how new API is expected to look like using qc_args_unsigned as example:

qc_args_unsigned(qc_args* args, char* longname, size_t* dst); // mandatory
qc_args_unsigned_default(qc_args* args, char* longname, size_t default, size_t* dst); // optional