Skip to content

[Console] Don't list aliases as separate commands #18351

@mnpenner

Description

@mnpenner

I've created aliases for many of my commands which is nice for typing but it creates a lot of duplicates in the command list. e.g.

Available commands:
  ci                 Commit outstanding changes # ALIAS
  dependencies       Lists all installed vendor packages.
  deps               Lists all installed vendor packages. # ALIAS
  help               Displays help for a command
  install            Installs dependencies
  list               Lists commands
  merge              Merge all branch heads
  mysql              Start MySQL REPL
  napi               Rebuilds your napi.json locally
  optimize           Optimizes composer's autoloader by caching class paths
  pkg                Lists all installed vendor packages. # ALIAS
 hg
  hg:backout         Prepare a new changeset with the specified revisions undone
  hg:branches        List all named branches
  hg:commit          Commit outstanding changes

It would be nice if instead the command list either excluded aliases, or put them in the description. e.g.

Available commands:
  dependencies       [deps|pkg] Lists all installed vendor packages.
  help               Displays help for a command
  install            Installs dependencies
  list               Lists commands
  merge              Merge all branch heads
  mysql              Start MySQL REPL
  napi               Rebuilds your napi.json locally
  optimize           Optimizes composer's autoloader by caching class paths
 hg
  hg:backout         Prepare a new changeset with the specified revisions undone
  hg:branches        List all named branches
  hg:commit          [ci] Commit outstanding changes

If you're worried about backwards compat or something, this can be made an option of the Application object. Right now it looks pretty hard-coded:

$this->commands[$command->getName()] = $command;

foreach ($command->getAliases() as $alias) {
    $this->commands[$alias] = $command;
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions