-
Notifications
You must be signed in to change notification settings - Fork 385
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
Introduce Directive symbol type #2056
Comments
I'm surprised that you want to place it in |
They will still be supported only at the start. The problem with config is that it does not belong to symbol tree. But |
I think this is important. We explicitly decided not to support directives anywhere on the command line after the first occurrence of a non-directive token. |
I'm not convinced that deriving If directive completion were a feature, then that could be a reason to derive from |
I believe that we should change that, otherwise how users are going to find out about their existence and capabilities?
We should consider that too. |
I think most end users will not care about directives (e.g. |
Or even [help] for directive-specific help. I feel that directives should not be specific to a command, not even to a RootCommand. Command-specific stuff should be options instead. Directives should be tied to the application model or I/O (are the command lines coming from Program.Main or from some network socket). I imagine there could even be a [load:path] directive with which a user could specify an assembly of more directive types, without the application explicitly supporting them; although this would need design for security and for compatibility with unmanaged applications. |
Agreed. The idea of hanging directives off of |
From #2046:
Currently the only way for the users to implement custom directives is enabling directives parsing in the config, using this property to get parsed output:
command-line-api/src/System.CommandLine/ParseResult.cs
Line 86 in 76437b0
and provide a custom, expensive Middleware.
We need to introduce a dedicated
Directive
type that derives fromSymbol
.Initial requirements:
Directive
symbol type, with a possibility to define anAction<ParseResult, string>
which should be executed when directive is parsed (the list of arguments for the action is an open question, when implementing the feature it should became more obvious)Command.Directives
property to allow users for defining directivescommand-line-api/src/System.CommandLine/Parsing/ParseOperation.cs
Lines 350 to 378 in 76437b0
The text was updated successfully, but these errors were encountered: