getopt usage help to stderr?
Andy Valencia
dont at spam.me
Tue Apr 8 20:14:56 UTC 2025
This seems like something which needs to be straightforward, and
yet I've spent a good amount of time getting nowhere.
How does one get the usage information which getopt embeds in a
result, and spit it out to stderr? The internals show some help
output, hard-coded to stdout. As any Posix CLI coder knows,
that's _not_ where you want error/help output to be forced. I
tried variations of:
```d
(GetoptResult rslt)
defaultGetoptFormatter!File(stderr, progname, rslt.options);
```
with no success. Is there really not a rslt.helpString() or
somesuch?
Thanks,
Andy
p.s. Ironically, I could probably have coded a getopt in less
time than I've spent on std.getopt....
More information about the Digitalmars-d-learn
mailing list