Cannot pass in negative values as option arguments

Issue #12 resolved
Former user created an issue

Something like the following:

./myRscript --threshold -0.3

does not work.

Comments (5)

  1. David Shih repo owner

    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.

  2. Greg Minshall

    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 --
    
  3. David Shih 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 or integer, depending on the passed arguments. Changing the value type of flags from logical to integer 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).

  4. Log in to comment