dotnet / dotnet/command-line-api

add support for either/or type binding for arguments

Open
#417 0 comments 1 reaction 0 assignees View on GitHub
Area-App Models enhancement
Dominant language
C#
Stars
3.7k
Forks
428
PR merge metrics
No merged PRs in 30d

Description

A common use case is that a given argument should be constrained to be parseable as either `DirectoryInfo` or `FileInfo`. There should be an API that makes this simple to express, performs input validation as expected, and binds the result correctly to a handler parameter.

While in this example a common base type (`FileSystemInfo`) could be passed to the handler, a related question is whether this should be a constraint. If a common base type is not required, the implication is that the type to which the argument is bound at runtime would drive overload resolution between different handlers, although this would add a lot of complexity and is probably not the best direction.

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.