1

I have an existing console app that takes option args that don't have the -- in front of them. For example:

./myapp businessDate=20230128 type=charley location=nashville

Currently I parse the args[] array tokens and split them around the "=" to get the key/value

I can't change that, because other programs already call it that way. But it appears that DragonFruit needs to have it this way instead.

./myapp --businessDate=20230128 type=charley --location=nashville

So my question is, can DragonFruit be configured to NOT use the -- prefix on options when I use the equals sign to separate the key from the value the way I currently do it in the example above? I believe the answer is "no", because of the Posix compliance. But maybe I missed something.

What I Tried

I ran the example program here Building your first app with System.CommandLine.DragonFruit And it worked fine when I ran it:

$ dotnet run --int-option=123 --bool-option=true
The value for --int-option is: 123
The value for --bool-option is: True
The value for --file-option is: null

But when I tried it without the --, this way instead, it gave me errors, and I was hoping it would work as above:

$ dotnet run int-option=123 bool-option=true
Unrecognized command or argument 'int-option=123'.
Unrecognized command or argument 'bool-option=true'.

0 Answers0