Command line parsing

Wyatt via Digitalmars-d digitalmars-d at puremagic.com
Mon May 2 07:01:17 PDT 2016


On Monday, 2 May 2016 at 12:52:42 UTC, Andrei Alexandrescu wrote:
>
> This is interesting because it's what std.getopt does but the 
> opposite of what GFLAGS (http://gflags.github.io/gflags/) does. 
> GFLAGS allows any module in a project to define flags. I was 
> thinking of adding GFLAGS-like capabilities to std.getopt but 
> looks like there's no need to... thoughts?

"Gflags, the commandline flags library used within Google..."

My perspective is those last three words are pretty important.  
It's a clever idea that's great when you have a whole mountain of 
things that live and work together that were _designed_ to do so, 
but I don't think it's going to generalise well.  It's sort of 
like Bazel, which works in Google's colossal pillar of code, but 
doesn't tend to make a lot of sense for most other projects.

I could be wrong, though.  I've been using JCommander 
(http://jcommander.org/#Overview) at work this last week, and it 
hasn't been too bad.  It's a bit different though, because Java 
and the actual control over what classes you scan for options is 
still in your hands. (If I'm reading this right, Gflags isn't 
something you easily have fine control over-- you use it or you 
don't.)

-Wyatt


More information about the Digitalmars-d mailing list