On Monday, 11 December 2017 at 21:24:41 UTC, Mike Wey wrote:
On 11-12-17 21:58, Jordi Gutiérrez Hermoso wrote:
[...]
I would use something like this, print the help information for
--help, print an error for invalid arguments:
```
try
{
auto helpInformation = getopt(
args,
"input|i", "The input", &input,
"output|o", "The output", &output
);
if (helpInformation.helpWanted)
{
defaultGetoptPrinter("Description", helpInformation.options);
exit(0);
}
}
catch (GetOptException e)
{
writeln(e.msg);
exit(1);
}
```
D style would be to use sth. like this (instead of try/catch):
```
scope(failure) {
e.msg.writeln;
1.exit;
}
```