Skip to content

Running/parsing parent command alongside with child command #221

@hellozyemlya

Description

@hellozyemlya

Hi. Is it possible to parse command lines more like urls /command//subcommand/?

For following commands:

[Command("group")]
public class GroupCommand : ICommand
{
    [CommandParameter(0, Description = "Group ID")]
    public string Group { get; set; }
    
    public async ValueTask ExecuteAsync(IConsole console)
    {
        await console.Output.WriteLineAsync("Group");
    }
}

[Command("group add")]
public class GroupAddCommand : ICommand
{
    [CommandParameter(0, Description = "group value")]
    public string Value { get; set; }
    public async ValueTask ExecuteAsync(IConsole console)
    {
        await console.Output.WriteLineAsync("Group");
    }
}

I want to achieve following behaviour: cli.exe group 123 add 321 e.g. parse all arguments and parameters for GroupCommand , and then parse GroupAddCommand. And of course get all the arguments in GroupAddCommand. Is it possible in current version?

Metadata

Metadata

Assignees

Labels

conceptHelp and further investigation on the proposal is needed.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions