Cysharp / ConsoleAppFramework

Zero Dependency, Zero Overhead, Zero Reflection, Zero Allocation, AOT Safe CLI Framework powered by C# Source Generator.
MIT License
1.54k stars 88 forks source link

Feature Request: Support Command Aliases #96

Closed roumcha closed 11 months ago

roumcha commented 1 year ago

(Previous issue title: Aliases are displayed twice in command list)

On the command help, command aliases are displayed twice.

Sample

Code

var app =
    ConsoleApp.Create(args)
    .AddCommands<Program>();

app.Run();

partial class Program : ConsoleAppBase
{
    [Command(new[] { "s", "sa", "sample" }, "Sample command.")]
    public void Sample() {
        Console.WriteLine("Hello from console app!");
    }
}

Output of dotnet run help

Commands:
  help                        Display help.
  s, sa, sample sa, sample    Sample command.
  version                     Display version.

Aliases sa and sample are displayed twice.

Cause

commandHelpDefinitions.Select(... in method BuildMethodListMessage (here) seems to generate the wrong help text.

x.Command already contains the aliases, but it gets concatinated with x.CommandAliases.

Environment

roumcha commented 1 year ago

I read the readme.md again and realized that it doesn't mention command aliases. Sorry.

So, please let this issue be a feature request for command aliases, if it has not yet been officially available.

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 30 days.