cobra icon indicating copy to clipboard operation
cobra copied to clipboard

Alias not shown in root help

Open akshaybabloo opened this issue 4 years ago • 5 comments

This issue is related to #633.

For example:

> someTool --help

Available Commands:
  help        Help about any command
  target      Print the version number of Hugo

> someTool target --help

Usage:
  nvmefc target [command]

Aliases:
  target, t, tar

Available Commands:
  list        Print the version number of Hugo

I would be nice to have an output something like:

Available Commands:
  help                 Help about any command
  target (t, tar)      Print the version number of Hugo

akshaybabloo avatar Apr 10 '21 03:04 akshaybabloo

This issue is being marked as stale due to a long period of inactivity

github-actions[bot] avatar Jun 10 '21 00:06 github-actions[bot]

Ping

akshaybabloo avatar Jun 10 '21 02:06 akshaybabloo

I think the issue with this is that some people use the Alias as a catchall to help the users but don't necessarily want to recommend it to them nor have it it elevated in the help to be as visible.

It can make the output look particularly poor if you consider that I was just looking at another issue about aliases and case-sensitivity. So you could have aliases currently that just have different casing which you definitely wouldn't wan't shown everywhere and messing with the default help output.

Going to leave open for a bit to let anyone else comment but without further motivation or reaction from the community I'd rather just close this.

johnSchnake avatar Feb 16 '22 20:02 johnSchnake

I requested this functionality in a downstream project at https://github.com/ddev/ddev/issues/6680. The precedents I cited there might be helpful here:

Composer (PHP Dependency Manager) shows aliases in brackets before the descriptions:

$ composer | grep '   \[' -m 5
  browse               [home] Opens the package's repository URL or homepage in your browser
  clear-cache          [clearcache|cc] Clears composer's internal package cache
  depends              [why] Shows which packages cause the given package to be installed
  dump-autoload        [dumpautoload] Dumps the autoloader
  install              [i] Installs the project dependencies from the composer.lock file if present, or falls back on the composer.json

Drush (Drupal command line shell interface) shows them in parentheses after the commands:

$ ddev drush --filter=watchdog | grep '  watchdog' -m 5
  watchdog:delete (wd-del, wd-delete, wd) Delete watchdog log records.
  watchdog:list (wd-list,watchdog-list)   Interactively filter the watchdog message listing.
  watchdog:show (wd-show, ws)             Show watchdog messages.
  watchdog:show-one (wd-one)              Show one log record by ID.
  watchdog:tail (wd-tail, wt)             Tail watchdog messages.

TravisCarden avatar Nov 12 '24 16:11 TravisCarden

I think it would be sensible if it was a configurable option, probably set off by default. That way developers can decide whether their cli project should display them or not.

GuySartorelli avatar Nov 12 '24 20:11 GuySartorelli