Tyrrrz / CliFx

Class-first framework for building command-line interfaces
MIT License
1.5k stars 61 forks source link

`IConsole.ReadKey` should return the key that was read #124

Closed OronDF343 closed 2 years ago

OronDF343 commented 2 years ago

Details

I'm trying to implement a prompt when the output file already exists, asking the user if they want to overwrite it (of course, I'm adding a -y option to disable this prompt).

Normally, I'd implement this with Console.ReadKey(false). However, the ReadKey method in CliFx does not return the key that was read.

Looking at the code, the issue that I can see with adding this feature is that FakeConsole will probably not behave consistently with SystemConsole.

Tyrrrz commented 2 years ago

Ugh, ReadKey() should really return something. Not sure why it was defined as void. I think this may have been a mistake.