Skip to content

Warn if overriding global argument #6173

@swissspidy

Description

@swissspidy

Feature Request

Describe your use case and the problem you are facing

Right now, it's possible for custom commands to override global arguments such as debug or user, either accidentally or willingly.

This can make for confusing user experience because flags won't work as expected.

Plus, it makes it difficult to introduce new global arguments in the future because you won't know about it.

Describe the solution you'd like

If a command defines an argument with the same name as an existing global argument in WP-CLI, there should be a warning either when registering that command or when running the command.

Stretch goal:

This functionality could be used to more easily introduce new global arguments as well, by warning if an argument clashes with one we intend to introduce in the future. For example, in v3.0.0 we could warn you about using argument "foo", but only actually introduce it in v3.1.0, where it would error instead.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions