Cocona icon indicating copy to clipboard operation
Cocona copied to clipboard

Cocona does not recognize subcommand alias

Open Pressacco opened this issue 9 months ago • 2 comments

Environment

  • <TargetFramework>net8.0</TargetFramework>
  • <PackageReference Include="Cocona" Version="2.2.0" />

Steps To Reproduce

  1. Create a JiraCommands class with at lease one Command
  2. Compile the Main listed below.
  3. Run: .\Demo.exe --help
    • Output will include: jira Sub commands can be used to query Jira.
      • notice that there is no mention of the j alias
  4. Run: .\Demo.exe jira --help
    • Output displays the expected commands
  5. Run: .\Demo.exe j --help
    • Output displays: 'j' is not a command.

Results

Expected Results

  • Expected to use j or jira interchangeably

Actual Results

  1. can run jira command
  2. cannot run j command
  3. j alias does not appear in the help

Sample Code

    internal class Program
    {
        static void Main()
        {
            var builder = CoconaApp.CreateBuilder();

            var application = builder.Build();

            application.AddSubCommand("jira", x =>
                {
                    x.AddCommands<JiraCommands>();
                })
                .WithDescription("Sub commands can be used to query Jira.")
                .WithAliases(new[] { "j" });

            application.Run();
        }
    }

Pressacco avatar May 24 '24 15:05 Pressacco