Am I reading this wrong, or is std.getopt *really* this stupid?

Adam D. Ruppe destructionator at gmail.com
Sat Mar 24 13:43:10 UTC 2018


On Friday, 23 March 2018 at 23:29:48 UTC, H. S. Teoh wrote:
> I just ran into this seemingly small problem:

The way I'd do this is to only use getopt to build the lists, 
then actually process them externally. (lol adding another loop)

string[] searchPaths;
string[] files;

getopt(args,
   "l", &files,
   "I", &searchPaths
);

foreach(file; files)
   openFile(file);


then it is clear what order your operations are done in anyway, 
and you have a chance to perhaps report bad syntax before 
actually doing any real work.

Wouldn't it be weird for example if

$ cat foo.d --help


spat out the contents followed by the help?


More information about the Digitalmars-d mailing list