Skip to content

Add support for argument aliases #6175

@swissspidy

Description

@swissspidy

Feature Request

Describe your use case and the problem you are facing

For most CLI tools it's common to have short and long form argument names that can be used interchangeably.

For example, npm install --save-dev is the same as npm install -D (or even npm i -D). composer update --with-dependencies is the same as composer update -w.

WP-CLI doesn't have that.

Describe the solution you'd like

Similar to command aliases, it would be nice to define aliases for arguments as well, both local and global. They could be used to define such shorter versions, but also for renaming deprecated arguments (like the deprecated --blog global argument).

An argument should be able to have multiple aliases.

If an --with-dependencies argument has an alias -w and I run wp <mycommand> -w, the $assoc_args array should still use the with-dependencies array key, so there should be no code change needed to accommodate the aliased version.


Related:

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions