dotnet / dotnet/command-line-api

Why are commands validated before options and arguments?

Open
#2,178 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

Scenario:

* Command with a birth date and a hire date
* The hire date must be in the last 20 years (young company)
* The hire date must be after the birth date

I think in this, and in most cases where options and arguments are involved in command validation, validating the options and arguments first makes sense.

In the current code (via reading) the command validation happens first, and if there are command validation errors options and arguments are not validated. I think we should reverse this, or at least remove the short circuit if the command validation fails.

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.