@@ -81,6 +81,29 @@ final class User_Application_Password_Command {
8181 * [--<field>=<value>]
8282 * : Filter the list by a specific field.
8383 *
84+ * [--uuid=<uuid>]
85+ * : Filter by the universally unique ID of the application password.
86+ *
87+ * [--app_id=<app_id>]
88+ * : Filter by the application ID. `--app-id` is also accepted.
89+ *
90+ * [--name=<name>]
91+ * : Filter by the name of the application password.
92+ *
93+ * [--password=<password>]
94+ * : Filter by the hashed password.
95+ *
96+ * [--created=<created>]
97+ * : Filter by the Unix timestamp the application password was created at.
98+ *
99+ * [--last_used=<last_used>]
100+ * : Filter by the Unix timestamp the application password was last used at.
101+ * `--last-used` is also accepted.
102+ *
103+ * [--last_ip=<last_ip>]
104+ * : Filter by the IP address the application password was last used from.
105+ * `--last-ip` is also accepted.
106+ *
84107 * [--field=<field>]
85108 * : Prints the value of a single field for each application password.
86109 *
@@ -186,10 +209,18 @@ static function ( $a, $b ) use ( $orderby, $order ) {
186209
187210 $ value = Utils \get_flag_value ( $ assoc_args , $ field );
188211
212+ // 'created' and 'last_used' come back from core as integers, while an
213+ // argument always arrives as a string, so compare them as strings.
214+ $ filter_value = is_scalar ( $ value ) ? (string ) $ value : '' ;
215+
189216 $ application_passwords = array_filter (
190217 $ application_passwords ,
191- static function ( $ application_password ) use ( $ field , $ value ) {
192- return $ application_password [ $ field ] === $ value ;
218+ static function ( $ application_password ) use ( $ field , $ filter_value ) {
219+ $ item_value = isset ( $ application_password [ $ field ] ) && is_scalar ( $ application_password [ $ field ] )
220+ ? (string ) $ application_password [ $ field ]
221+ : '' ;
222+
223+ return $ item_value === $ filter_value ;
193224 }
194225 );
195226 }
0 commit comments