Skip to content

Create alias for subcommand #152

Closed
Closed

Description

@fu050409

Describe the feature

Hey! Sometimes we faced with a situation that we should create alias for subcommands. For example, pnpm i and pnpm install. The subcommand named i and subcommand named install is the same command.

The solution now is to create two subcommands with same value, like:

subCommands: { i: installCommand, install: installCommand }

But this looks not so elegant. Can we support alias parameter for defineCommand? I can work for my issue.

Additional information

  • Would you be willing to help implement this feature?

Activity

  1. added
    enhancement
    on Jul 5, 2024
  2. zuixinwang commented on Jul 15, 2024

    @zuixinwang
    Contributor

    it's a good idea, but the help output should also be considered

  3. naruko-hstk commented on Jan 21, 2026

    @naruko-hstk

    maybe let help output like this?

    install    Install packages.(alias:i)
    
  4. ratiofu commented on Feb 7, 2026

    @ratiofu
    Contributor

    Or perhaps

    install, i    Install packages
    
  5. BlueBazze commented on Feb 24, 2026

    @BlueBazze

    Shouldn't it just keep the standard of the | separator like in the usage display?
    npx nuxt -> USAGE nuxi [OPTIONS] [COMMAND] add|add-template|analyze|build|cleanup|_dev|dev|devtools|generate|info|init|module|prepare|preview|start|test|typecheck|upgrade|complete

    Meaning the alias shown under commands like:

    install|i    Install packages

    As an example with nuxt cli

     add|a    Add Nuxt modules
     dev|d    Run Nuxt development server
    test|t    Run tests   

    Perhaps with either differently colored separator, or spacing to differentiate between the commands.

  6. added a commit that references this issue on Mar 15, 2026
    b4d9a96
  7. added a commit that references this issue on Mar 15, 2026
    6840275
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions