Skip to content

Support metadata based CLI: was Demo/test case: TaskRunner parsing #461

Open
@jzabroski

Description

@jzabroski

Imagine an exe called TaskRunner.dll that has a bunch of TaskDefinition<T> 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<T> : ITaskDefinition where T : ITask
{
  public abstract string Key { get; }
}
public class CleanFullTaskDefinition<T> : TaskDefinition<CleanFullTask>
{
  public override string Key => "cleanfull";
}
public class SqlExecuteTaskDefinition<T> : TaskDefinition<SqlExecuteTask>
{
  public override string Key => "sqlcmd";
}
public class FluentMigratorTaskDefinition<T> : TaskDefinition<FluentMigratorTask>
{
  public override string Key => "fm";
}
// etc, 1,000s of tasks to build Gilles Tréhin's Urville :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions