Hi All,

When i run the below program without any arguments "D1.d -r" it is throwing error, but i need it to show the help menu

Program:
import std.stdio;
import std.getopt;
string r;
void main (string[] args)
{
getopt(args, std.getopt.config.caseInsensitive, std.getopt.config.stopOnFirstNonOption, "r" , &r);
 switch (r) {
 case "Test1" : Test1; break;
 case "Test2" : Test2; break;
 default : writeln("Unknown operation"); Help;
                    }
}
void Test1 ()
{ writeln("This is Test 1");  }
void Test2 ()
{ writeln("This is Test 2"); }
void Help ()
{ writeln("This is Help Menu"); }

Execution:
Works fine if i execute the program with below options
rdmd D1.d
rdmd D1.d -r Test1
rdmd D1.d -r Test2
rdmd D1.d -r Help

but fails with below error when i execute the program as rdmd D1.d -r

Requirement :
If i execute the program as "rdmd D1.d -r" is should show me the "Help" Menu rather than the below error/

Output:
C:\Admin\Desktop\Current\Script\D>rdmd D1.d -r

object.Exception@C:\D\dmd2\windows\bin\..\..\src\phobos\std\getopt.d(880): 
Missing value for argument -r.
----------------
0x00402493
0x004043AC
0x00402999
0x004025FE
0x004025C5
0x0040239B
0x00402236
0x0040B47F
0x0040B443
0x0040B344
0x00405E07
0x76CB336A in BaseThreadInitThunk
0x77CF9902 in RtlInitializeExceptionChain
0x77CF98D5 in RtlInitializeExceptionChain

From,
Vino.B

Reply via email to