dotnet / command-line-api

Command line parsing, invocation, and rendering of terminal output.
https://github.com/dotnet/command-line-api/wiki
MIT License
3.38k stars 381 forks source link

Consider hyphen support for files in Powderhouse #2455

Open KathleenDollard opened 2 months ago

KathleenDollard commented 2 months ago

The Powderhouse label is currently being used to mark items that are not applicable to main. I do not want to mark issues that are entered for main with this label since this was not the attention of the author. This issue is interesting, and I have a couple ideas of how it might work

2432 Feature request: Support POSIX standard of using single hyphen "-" to mean standard input

Discussion of this feature that is not specific to Powderhouse should continue there.

The request is to allow conformance to Guideline 13 of 12.1 Utility Argument Syntax

Thanks to @moh-hassan for the issue #2432

Implementation notes

We anticipate providing file and directory argument and options to avoid file artifacts such as FileExists on all arguments. These specialized symbols can have a SupportsHyphen. The dash will be considered valid input and will simply be passed on to later operations, especially due to the wording of Guideline 13's last clause:

Guideline 13: For utilities that use operands to represent files to be opened for either reading or writing, the '-' operand should be used to mean only standard input (or standard output when it is clear from context that an output file is being specified) or a file named -.

Note: that file validators probably need to manage this scenario.

Note: This removes one reason to use custom parsers