dotnet / dotnet/command-line-api
Support metadata based CLI: was Demo/test case: TaskRunner parsing
- Dominant language
- C#
- Stars
- 3.7k
- Forks
- 428
- PR merge metrics
- No merged PRs in 30d
Description
Imagine an exe called TaskRunner.dll that has a bunch of `TaskDefinition` sub-classes.
I would like to provide dotnet-suggest support for each one. To do this, I would need to load, using reflection, an instance of each `TaskDefinition` and be able to explain to `System.CommandLine` how to use this metadata to provide command line auto-completion suggestions.
```
public interface ITaskDefinition { string Key { get; } }
public abstract class TaskDefinitionBase : ITaskDefinition where T : ITask
{
public abstract string Key { get; }
}
public class CleanFullTaskDefinition : TaskDefinition
{
public override string Key => "cleanfull";
}
public class SqlExecuteTaskDefinition : TaskDefinition
{
public override string Key => "sqlcmd";
}
public class FluentMigratorTaskDefinition : TaskDefinition
{
public override string Key => "fm";
}
// etc, 1,000s of tasks to build Gilles Tréhin's Urville :)
```
Contributor guide
Assessment
This issue has not been assessed yet.