spectre.console icon indicating copy to clipboard operation
spectre.console copied to clipboard

Command aliases do not show in the help display

Open dlandi opened this issue 3 years ago • 5 comments

Example: config.AddCommand<InstallCloudCommand>("install-cloud") .WithAlias("cloud").WithAlias("cld"); //config.AddCommand<InstallCloudCommand>("cloud"); //config.AddCommand<InstallCloudCommand>("cld");

If you use config.AddCommand(), each command shows up in help display, but the WithAlias() option does not.

dlandi avatar Dec 10 '21 11:12 dlandi

@dlandi thanks for reporting this. Do you have any idea on what the help display should look like, if aliases were reported?

nils-a avatar Dec 10 '21 19:12 nils-a

Sure. Given:

      config.AddCommand<InstallCloudCommand>("install-cloud")
      .WithDescription("Install Cloud API from Zip File")
      .WithAlias("cloud").WithAlias("cld");
      
      config.AddCommand<InitializeAccountCommand>("init-account")
      .WithDescription("Initialize Account DB from Powershell Script File")
       WithAlias("account").WithAlias("adb"); 
      
       config.AddCommand<InitializeCloudDb>("init-cloud-db")
      .WithDescription("Initialize Cloud Database from Powershell Script File")
      .WithAlias("cloud-db").WithAlias("cdb");

Output would be :

Command          Alias[es]		Description
-------------------------------------------------------------------------------
install-cloud          [cloud|cld]               Install Cloud API from Zip File
init-account          [account|adb]          Initialize Account DB from Powershell Script File
init-cloud-db        [cloud-db|cdb]        Initialize Cloud Database from Powershell Script File

dlandi avatar Dec 10 '21 19:12 dlandi

Since the commands' section does not have headers, this would look like:

COMMANDS:
    dog <AGE>           some-dog, a-dog        The dog command
    giraffe <LENGTH>                           The giraffe command
    horse               some-horse, a-horse    The horse command

or

COMMANDS:
    dog <AGE>           [some-dog|a-dog]        The dog command
    giraffe <LENGTH>                            The giraffe command
    horse               [some-horse|a-horse]    The horse command

I feel adding a cell "aliases" to the commands' section would take away too much space (which is sometimes very limited in CLI).

What about adding it to the description? Something like:

COMMANDS:
    dog <AGE>           The dog command
                        Aliases: some-dog, a-dog
    giraffe <LENGTH>    The giraffe command
    horse               The horse command
                        Aliases: some-hosre, a-horse

@patriksvensson, @phil-scott-78: Any ideas or opinions?

nils-a avatar Dec 11 '21 20:12 nils-a

Hi there. I'd like to do it. What do you think about this layout?

COMMANDS:
    build-something        [build|b]    Builds something 
    no-alias                            Some description 
    create                 [c]          Creates something

BatanGaming avatar Mar 11 '23 07:03 BatanGaming

What about adding it to the description? Something like:

COMMANDS:
    dog <AGE>           The dog command
                        Aliases: some-dog, a-dog
    giraffe <LENGTH>    The giraffe command
    horse               The horse command
                        Aliases: some-hosre, a-horse

@patriksvensson, @phil-scott-78: Any ideas or opinions?

Did anything happen with this? I like the approach of putting the aliases under the description, as that makes the best use of space, IMO.

Pete

Psychlist1972 avatar Jan 05 '24 06:01 Psychlist1972