Skip to content

Commit 248cbb9

Browse files
committed
Initialize formatter in better way
1 parent 05b0198 commit 248cbb9

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/User_Application_Password_Command.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,11 +198,13 @@ static function ( $application_password ) use ( $field, $value ) {
198198
$fields = explode( ',', $assoc_args['fields'] );
199199
}
200200

201-
if ( ! empty( $assoc_args['format'] ) && 'ids' === $assoc_args['format'] ) {
202-
$formatter = new Formatter( $assoc_args );
201+
$format = Utils\get_flag_value( $assoc_args, 'format', 'table' );
202+
203+
$formatter = new Formatter( $assoc_args, $fields );
204+
205+
if ( 'ids' === $format ) {
203206
$formatter->display_items( wp_list_pluck( $application_passwords, 'uuid' ) );
204207
} else {
205-
$formatter = new Formatter( $assoc_args, $fields );
206208
$formatter->display_items( $application_passwords );
207209
}
208210
}

0 commit comments

Comments
 (0)