Skip to content

Commit 1d2d903

Browse files
claudeswissspidy
andcommitted
Declare dash-separated aliases of user application-password list filters
WP-CLI now warns when a parameter passed to a command with a `--<field>=<value>` catch-all looks like a typo of a documented one (wp-cli/wp-cli#6392). `wp user application-password list` accepts `--app-id`, `--last-used` and `--last-ip` as aliases of `--app_id`, `--last_used` and `--last_ip`, but only mentioned them in prose and normalized them by hand, so the framework reported them as typos and the Behat scenarios using them failed on unexpected STDERR output. Declare the aliases with the framework's `--param=<value>|alias` synopsis syntax instead. The dispatcher resolves them to the canonical names before validation, so no warning is emitted and the manual dash-to-underscore normalization in the command becomes unnecessary. Co-authored-by: Pascal Birchler <pascal.birchler@gmail.com> Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TAVTmW8kHx829E8486uMaF
1 parent fd471bb commit 1d2d903

1 file changed

Lines changed: 6 additions & 15 deletions

File tree

‎src/User_Application_Password_Command.php‎

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ final class User_Application_Password_Command {
8484
* [--uuid=<uuid>]
8585
* : Filter by the universally unique ID of the application password.
8686
*
87-
* [--app_id=<app_id>]
88-
* : Filter by the application ID. `--app-id` is also accepted.
87+
* [--app_id=<app_id>|app-id]
88+
* : Filter by the application ID. `--app-id` is accepted as an alias.
8989
*
9090
* [--name=<name>]
9191
* : Filter by the name of the application password.
@@ -96,13 +96,13 @@ final class User_Application_Password_Command {
9696
* [--created=<created>]
9797
* : Filter by the Unix timestamp the application password was created at.
9898
*
99-
* [--last_used=<last_used>]
99+
* [--last_used=<last_used>|last-used]
100100
* : Filter by the Unix timestamp the application password was last used at.
101-
* `--last-used` is also accepted.
101+
* `--last-used` is accepted as an alias.
102102
*
103-
* [--last_ip=<last_ip>]
103+
* [--last_ip=<last_ip>|last-ip]
104104
* : Filter by the IP address the application password was last used from.
105-
* `--last-ip` is also accepted.
105+
* `--last-ip` is accepted as an alias.
106106
*
107107
* [--field=<field>]
108108
* : Prints the value of a single field for each application password.
@@ -193,15 +193,6 @@ static function ( $a, $b ) use ( $orderby, $order ) {
193193

194194
$fields = self::APPLICATION_PASSWORD_FIELDS;
195195

196-
// Avoid confusion regarding the dash/underscore usage.
197-
foreach ( [ 'app-id', 'last-used', 'last-ip' ] as $flag ) {
198-
if ( array_key_exists( $flag, $assoc_args ) ) {
199-
$underscored_flag = str_replace( '-', '_', $flag );
200-
$assoc_args[ $underscored_flag ] = $assoc_args[ $flag ];
201-
unset( $assoc_args[ $flag ] );
202-
}
203-
}
204-
205196
foreach ( $fields as $field ) {
206197
if ( ! array_key_exists( $field, $assoc_args ) ) {
207198
continue;

0 commit comments

Comments
 (0)