Cannot pass in negative values as option arguments
Something like the following:
./myRscript --threshold -0.3
does not work.
Comments (5)
-
repo owner -
Hi, is there any news on this?
-
i am also running into this. it would be nice if unix getopt(1, 3) behavior were folllowed here:
% getopt abcd:efg:h -abd -g -g x -a -b -d -g -g x --
-
repo owner Negative value issue fixed in commit 7175edb.
The ability to parse concatenated short-form argument names (e.g. convert
-abd
to-a -b -d
) is added in commit 4bc0c39.Caveat 1: the string cannot start with a number (e.g.
-035
to avoid parsing numbers.)Caveat 2: argument values still must appear in immediately after each argument label/name. Allowing the argument values to be anymore complicates parsing and may not even be feasible due to the possibility of arguments that consume an indefinitely number of values. Therefore, this splitting feature is probably only useful for flags.
I will not support counting the number of times a flag is specified at the command line, since the type of the argument value can be a
logical
orinteger
, depending on the passed arguments. Changing the value type of flags fromlogical
tointeger
may create backward incompatibility with some existing code. I also personally don't like the value type being ambiguous, even though R's conditional statements can handle it.A cleaner command line interface design would be to specify explicitly whether an argument is a flag (e.g. verbose vs. not) or an integer-consuming argument (e.g. verbosity level).
-
repo owner - changed status to resolved
Main issue fixed in commit 7175edb.
- Log in to comment
I can reproduce this error, which is caused by incorrect recognition of the negative number as an optional argument name. I'll see how it can be fixed for v0.4.