std.getopt: Unexpected behavior when using incremental options

Ky-Anh Huynh saigon at example.net
Sun Jul 29 09:28:41 UTC 2018


Hi,

I am using std.getopt and expect to parse an incremental option 
with different names: --long, --longer, -l. The sample code is 
here

https://gist.github.com/icy/b8ed758b48134b369e854205aeb8f308

excerpt:

[code]
   auto results = getopt(args,
     std.getopt.config.noBundling,
     std.getopt.config.passThrough,
     "longer|long|l+", &s_long
);
[/code]

I don't expect the program also accepts `-long` , unfortunately 
it does. The default help message also prints incorrect 
information:

[code]
$ rdmd tests.d  -l -long --long --longer -h
Basic usage:
-long --longer
    -h   --help This help information.
How long it is: 4
Remained: 
"/tmp/.rdmd-314/rdmd-tests.d-0C7A52ECD8084516F3064EED864D6E86/tests"
[/code]


Did I have something wrong with my code?

Thanks for your reading and support.


More information about the Digitalmars-d mailing list