New library: argparse, for parsing CLI arguments

Andrey Zherikov andrey.zherikov at gmail.com
Wed Oct 13 15:50:12 UTC 2021


On Wednesday, 13 October 2021 at 14:36:30 UTC, Steven 
Schveighoffer wrote:
> One nitpick -- you should be able to opt in using the name of 
> the field member instead of having to write `@NamedArgument`. 
> e.g. your `string unused` parameter requires a 
> `@NamedArgument("unused")` which seems unnecessary.

I think `unused` word confuses a bit. I meant the argument that 
is skipped in command line so it has a default value (`"some 
default value"`).
So having this is totally fine:
```d
struct Params
{
     string s;

     @NamedArgument("num")
     int n;
}

```

I'll rename `unused` to remove this confusion.


More information about the Digitalmars-d-announce mailing list