commandline icon indicating copy to clipboard operation
commandline copied to clipboard

Initializing a parser with the configuration lambda does nothing.

Open mattfinnell opened this issue 6 years ago • 2 comments

A requirement for my project involves that the command line arguments that I pass in look like argumentKey=argumentValue. I recognize that this tool defaults to parsing items as --argumentKey=argumentValue. So I naturally was led into trying the following.

static void Main(string[] args){
    var parser = new Parser(config => config.EnableDashDash = false);

    return parser.ParseArguments<MyOptions>(args)
        .MapResult(RunMyProgram, errors => -1);
}

Problem is though, initializing that new Parser has no effect on the program and there doesn't seem to be any documentation on how to configure the parser.

Any help on this is much appreciated!

mattfinnell avatar Apr 04 '18 19:04 mattfinnell

I'm also having hard time understading how to pass settings into a new non-default parser.

danmincu avatar Feb 26 '21 05:02 danmincu

The EnableDashDash setting has nothing to do with the prefix of a field (- vs -- vs none). Have a look: https://github.com/commandlineparser/commandline/wiki/P_CommandLine_ParserSettings_EnableDashDash

Carsten-MaD avatar Mar 06 '23 13:03 Carsten-MaD