Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Design] Is any syntax (like punctuation) is allowed for commands? #2401

Open
KathleenDollard opened this issue Apr 23, 2024 · 4 comments
Open
Labels
Design Powderhouse Work to isolate parser and features

Comments

@KathleenDollard
Copy link
Contributor

KathleenDollard commented Apr 23, 2024

Hyphens in command names would be allowed.

Do we want to do things like allowing --help to be a command?

@KalleOlaviNiemitalo
Copy link

KalleOlaviNiemitalo commented Apr 23, 2024

Hyphens must be supported in subcommand names (dotnet build-server).

The root command name should allow dots too, for version numbers (myapp2.3).

@KathleenDollard
Copy link
Contributor Author

@KalleOlaviNiemitalo Thanks! I updated the description a touch.

@KalleOlaviNiemitalo
Copy link

KalleOlaviNiemitalo commented Apr 24, 2024

I don't see a pressing need for --help as a command. There is some precedent in curl --help all but I think this can be supported by making all an optional argument of the --help option. IIRC, GNU getopt_long parses an optional argument of a long option only if connected with an equals sign as in --help=all; if System.CommandLine is made to also behave this way, i.e. parse --help all as an option followed by an unrelated argument, then application developers should still be able to override this behavior by giving the --help option a custom parser that consumes the all token even if not connected.

@KalleOlaviNiemitalo
Copy link

There is the convention of a login shell getting an argv[0] that starts with a hyphen. For example, -bash. That should then be allowed in the root command name, too. But the .NET Runtime does not currently pass the string through to applications (#2365, dotnet/runtime#30212).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Design Powderhouse Work to isolate parser and features
Projects
None yet
Development

No branches or pull requests

2 participants