On Wednesday, 13 December 2017 at 07:37:17 UTC, Jonathan M Davis
wrote:
On Wednesday, December 13, 2017 06:55:46 bauss via
Digitalmars-d-learn wrote:
[...]
If it works, it's a bug related to code lowering (since scope
statements are always lowered to try-catch-finally blocks).
You're not
On Wednesday, December 13, 2017 06:55:46 bauss via Digitalmars-d-learn
wrote:
> On Tuesday, 12 December 2017 at 18:34:26 UTC, Mike Wey wrote:
> > On 12-12-17 00:35, Seb wrote:
> >> D style would be to use sth. like this (instead of try/catch):
> >>
> >> ```
> >> scope(failure) {
> >>
> >>
On Tuesday, 12 December 2017 at 18:34:26 UTC, Mike Wey wrote:
On 12-12-17 00:35, Seb wrote:
D style would be to use sth. like this (instead of try/catch):
```
scope(failure) {
e.msg.writeln;
1.exit;
}
```
I might have missed something, but where is `e` defined in this
case?
I was
On Tuesday, 12 December 2017 at 20:57:28 UTC, Jon Degenhardt
wrote:
On Monday, 11 December 2017 at 20:58:25 UTC, Jordi Gutiérrez
Hermoso wrote:
What's the proper style, then? Can someone show me a good
example of how to use getopt and the docstring it
automatically generates?
[snip]
See:
On Monday, 11 December 2017 at 20:58:25 UTC, Jordi Gutiérrez
Hermoso wrote:
What's the proper style, then? Can someone show me a good
example of how to use getopt and the docstring it automatically
generates?
The command line tools I published use the approach described in
a number of the
On 12-12-17 00:35, Seb wrote:
D style would be to use sth. like this (instead of try/catch):
```
scope(failure) {
e.msg.writeln;
1.exit;
}
```
I might have missed something, but where is `e` defined in this case?
--
Mike Wey
On Monday, December 11, 2017 15:38:44 H. S. Teoh via Digitalmars-d-learn
wrote:
> On Mon, Dec 11, 2017 at 11:35:53PM +, Seb via Digitalmars-d-learn
> wrote: [...]
>
> > D style would be to use sth. like this (instead of try/catch):
> >
> > ```
> > scope(failure) {
> >
> > e.msg.writeln;
> >
On Monday, 11 December 2017 at 20:58:25 UTC, Jordi Gutiérrez
Hermoso wrote:
I don't quite understand what to do if getopt throws. I would
have hoped for something like
I might have already said this to you on IRC but the way I'd do
it (if you must do this) is:
void main(string[] args) {
On Mon, Dec 11, 2017 at 11:35:53PM +, Seb via Digitalmars-d-learn wrote:
[...]
> D style would be to use sth. like this (instead of try/catch):
>
> ```
> scope(failure) {
> e.msg.writeln;
> 1.exit;
> }
> ```
Frankly, much as I love UFCS syntax, I think this is taking it a little
too far.
On Monday, 11 December 2017 at 21:24:41 UTC, Mike Wey wrote:
try
{
auto helpInformation = getopt(
args,
"input|i", "The input", ,
"output|o", "The output",
);
if (helpInformation.helpWanted)
{
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(
On 11-12-17 21:58, Jordi Gutiérrez Hermoso wrote:
but instead, the docstring from getopt is only generated if all
arguments are valid, i.e. when it's the least needed because the user
already knew what to input.
What's the proper style, then? Can someone show me a good example of how
to use
I don't quite understand what to do if getopt throws. I would
have hoped for something like
int arg1;
string arg2;
auto parser = getopt("opt1", "docstring 1", , "opt2",
"docstring 2", );
try {
auto opts = parser.parse(args)
}
except(BadArguments) {
13 matches
Mail list logo