CommandLineParser.Core icon indicating copy to clipboard operation
CommandLineParser.Core copied to clipboard

Issue when using - as stdin and stdout

Open carstencodes opened this issue 1 year ago • 2 comments

Hi,

thanks for your nice work.

I have an issue when I declare my arguments as follows:

-f --format (output format) -o --output (output file, - is supported for using stdout) input-file (input file, - is supported for stdin)

But when I run my app as follows,

app -f json -o - input.file

then - is used as input-file and input.file is bound to -o.

This is rather unexpected.

carstencodes avatar Oct 26 '24 20:10 carstencodes

Hi @carstencodes, thank you for reporting this bug.

Is it possible to use something like ~ or any other character to indicate stin/stdout?

The problem probably is that - is parsed as an option instead of value.

I don't have a lot of time to look at this right now, but I'm happy to review PRs that fix this.

Matthiee avatar Oct 26 '24 21:10 Matthiee

Hi,

I try to be as unix compatible as possible in my application. And the convention here is to use the minus for these streams.

I have read the code a bit and I think the issue is really weird, but bound to a faulty (or rather non-existent) state machine in the ArgumentManager class.

This might take a bit, maybe I'll figure it out ...

carstencodes avatar Oct 26 '24 23:10 carstencodes