New library: argparse, for parsing CLI arguments
WebFreak001
d.forum at webfreak.org
Wed Oct 13 13:04:20 UTC 2021
On Wednesday, 13 October 2021 at 12:11:03 UTC, Andrey Zherikov
wrote:
> On Wednesday, 13 October 2021 at 11:59:06 UTC, WebFreak001
> wrote:
>> On Wednesday, 13 October 2021 at 11:27:40 UTC, Andrey Zherikov
>> wrote:
>>> [...]
>>> It also doesn't depend on anything besides the standard
>>> library.
>>> [...]
>>
>> if you want to drop the dependency on std.typecons : Nullable
>> you could use https://code.dlang.org/packages/expected, where
>> you can additionally return error values with instead of
>> returning null on error.
>>
>> Doesn't cast to bool but can check for .hasError which is more
>> explicit.
>
> This will break "doesn't depend on anything besides std"
> unfortunately.
well... if you ask me that expected package should be part of the
stdlib, it has decent download statistics too :p
At least would be better than creating your own Result type if
you do decide to drop Nullable for something with error
information I think
More information about the Digitalmars-d-announce
mailing list