dotnet / dotnet/command-line-api

Consider custom parsers and validators for directives

Open
#2,179 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
3.7k
Forks
428
PR merge metrics
No merged PRs in 30d

Description

Directives are explicitly outside Posix rules, so we cannot parse the contents of a directive.

However, the CLI author will parse somewhere. I think the flow of directive from information, and possibly action, directives will be smoother if directives can be parsed and validated at the same time as Commands, Options and Arguments.

I believe this would just involve extending a few more things we do to other symbols to directives.

As an example, if the directive creates a custom type that might be used by multiple command actions, having that custom type created during parsing would avoid duplicating the work (or the call to the work). Also, pre-actions will be skipped when validation failures are recognized during parsing. If we delay validation until the command action runs, the pre-actions would already have been performed.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.