Am I reading this wrong, or is std.getopt *really* this stupid?
H. S. Teoh
hsteoh at quickfur.ath.cx
Sat Mar 24 15:35:56 UTC 2018
On Sat, Mar 24, 2018 at 01:43:10PM +0000, Adam D. Ruppe via Digitalmars-d wrote:
> 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?
Touche. This uglifies the code a bit, but meh. It's just main(), no
biggie.
T
--
INTEL = Only half of "intelligence".
More information about the Digitalmars-d
mailing list