mayuki / Cocona

Micro-framework for .NET console application. Cocona makes it easy and fast to build console applications on .NET.
MIT License
3.26k stars 85 forks source link

Cocona does not recognize subcommand alias #145

Open Pressacco opened 5 months ago

Pressacco commented 5 months ago

Environment

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

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 commented 5 months ago

BTW - great library @mayuki 🥇

MensoDev commented 2 weeks ago

I'm having the same problem, 'WithAliases' is not working with 'AddSubCommand'.