-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
I have the following setup:
public class CommandArgs
{
[Parameter("verbose", Required = Required.No)
public bool Verbose { get; set; }
[Command("go")]
public GoCommand GoCmd { get; set; }
}
public class GoCommand : ICommand
{
[Parameter("x")]
public string X { get; set; }
public void Execute(object parent)
{
var globalArgs = (CommandArgs)parent;
Console.Writeline(globalArgs.Verbose); // <-- always false
}
}
Expected: the value of the CommandArgs.Verbose
should be set to true when --verbose
is supplied on the command-line.
Actual: the value is ignored.
If I change this code and move the Verbose
flag to the GoCommand
class, it does get picked up correctly.
I'm using .NET Core 5 in Visual Studio 2022.
Metadata
Metadata
Assignees
Labels
No labels