On Monday, 26 August 2013 at 06:58:41 UTC, Ramon wrote:
There seems to be a bug in std.getopt.
D doc says:
"To set timeout to 5, use either of the following: --timeout=5,
--timeout 5, --t=5, --t 5, or ** -t5 **. Forms such as -t 5 and
-timeout=5 will be not accepted."
However
bool reverseOrder = false, helpFlag = false;
int colOrder = 1;
getopt(args, std.getopt.config.bundling, "reverse|r",
&reverseOrder, "column|c", &colOrder,"help|?", &helpFlag);
sets colOrder to -1 rather than to +1 when the commandline has
"-c1" as arg.
Funnily, when the arg is *illegally* "-c 1", the variable is
set correctly to +1.
Given:
int colOrder = 1;
...
Could it be that "-c 1" is ignored because it is in invalid and
the default colOrder value is used?
This is not an urgent issue because there is a very simple
workaround:
colorder = - colorder;
But I thought it should be mentioned anyway and, if not noticed
it can create troublesome situations.
Being at that, the official rule "-t 5" is not acceptable is
problematic because that form is pretty commonly used on unix
and even sometimes used in docs.
+1
I've noticed this before when using getopt. It is low priority
and a documented limitation but it would be nice if "-t 5" worked.
G.