getopt short-options documentation
Antonio Corbi
acrb at ggmail.com
Fri Nov 30 08:17:32 UTC 2018
On Thursday, 29 November 2018 at 20:55:22 UTC, Daniel Kozak wrote:
> Are you sure? Can you show me an example? I always forgot on
> this limitation and somtimes it cause really nesty things :D
>
> On Thu, Nov 29, 2018 at 6:05 PM Antonio Corbi via
> Digitalmars-d-learn < digitalmars-d-learn at puremagic.com> wrote:
>
>> Hi!
>>
>> Reading through the `getopt` documentation at one point it
>> says:
>>
>> "Forms such as -t 5 and -timeout=5 will be not accepted."
>>
>> But I'm able to to use short options like '-t 5' (with spaces
>> between the 't' and the '5'). It seems that this limitation
>> has been eliminated and it just-works-now, is it so?
>>
>> Thx!
Hi Daniel!
Try this one :
-------
module tools.trainer;
import std.stdio, std.getopt;
//////////////////
// Main Program //
//////////////////---------------------------------------------------------
int main(string[] args) {
dchar letter = 'ñ';
string[] inputFiles;
string[] cmpFiles;
arraySep = ","; // defaults to "", separation by whitespace
auto helpInformation = getopt(args,
"letter|l", "The char that
represent the input images.", &letter,
"inputf|i", "The files that
represent the image of the same char.", &inputFiles,
"cmpf|c", "The files that
represent images of other chars to compare with.", &cmpFiles);
if (helpInformation.helpWanted) {
defaultGetoptPrinter("Some information about the program.",
helpInformation.options);
}
writeln("Letter selected is: ", letter);
return 0;
}
---------
trainer -l Y
trainer -lY
Both of them work for me.
Antonio
More information about the Digitalmars-d-learn
mailing list