diff --git a/features/user-application-password.feature b/features/user-application-password.feature index eb30311f..5c7e5d1c 100644 --- a/features/user-application-password.feature +++ b/features/user-application-password.feature @@ -244,6 +244,12 @@ Feature: Manage user custom fields myapp2 """ + When I run `wp user application-password list 1 --format=ids --orderby=created --order=asc` + Then STDOUT should be: + """ + {UUID1} {UUID2} + """ + @require-wp-5.6 Scenario: Get particular user application password hash Given a WP install diff --git a/src/User_Application_Password_Command.php b/src/User_Application_Password_Command.php index 5203cbac..89cb4ea9 100644 --- a/src/User_Application_Password_Command.php +++ b/src/User_Application_Password_Command.php @@ -97,6 +97,7 @@ final class User_Application_Password_Command { * - json * - count * - yaml + * - ids * --- * * [--orderby=] @@ -197,8 +198,15 @@ static function ( $application_password ) use ( $field, $value ) { $fields = explode( ',', $assoc_args['fields'] ); } + $format = Utils\get_flag_value( $assoc_args, 'format', 'table' ); + $formatter = new Formatter( $assoc_args, $fields ); - $formatter->display_items( $application_passwords ); + + if ( 'ids' === $format ) { + $formatter->display_items( wp_list_pluck( $application_passwords, 'uuid' ) ); + } else { + $formatter->display_items( $application_passwords ); + } } /**