Help Required on Getopt
Jon Degenhardt via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Sep 1 14:41:21 PDT 2017
On Friday, 1 September 2017 at 19:04:39 UTC, Daniel Kozak wrote:
> I have same issue. How this help you? Catching exception does
> not help. How do I catch exception and still print help message?
Your are correct, sorry about that. What my response showed is
how to avoid printing the full stack trace and instead printing a
more nicely formatted error message. And separately, how to print
formatted help. But, you are correct in that you can't directly
print the formatted help text from the catch block as shown.
In particular, the GetoptResult returned by getopt is not
available. I don't have any examples that try to work around
this. Presumably one could call getopt again to get the options
list, then generate the formatted help. It'd be an annoyance,
though perhaps judicious use of AliasSeq might make the code
structure reasonable.
--Jon
More information about the Digitalmars-d-learn
mailing list