Skip to content

Commit

Permalink
Initialize formatter in better way
Browse files Browse the repository at this point in the history
  • Loading branch information
ernilambar committed Mar 14, 2024
1 parent 05b0198 commit 248cbb9
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/User_Application_Password_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,13 @@ static function ( $application_password ) use ( $field, $value ) {
$fields = explode( ',', $assoc_args['fields'] );
}

if ( ! empty( $assoc_args['format'] ) && 'ids' === $assoc_args['format'] ) {
$formatter = new Formatter( $assoc_args );
$format = Utils\get_flag_value( $assoc_args, 'format', 'table' );

$formatter = new Formatter( $assoc_args, $fields );

if ( 'ids' === $format ) {
$formatter->display_items( wp_list_pluck( $application_passwords, 'uuid' ) );
} else {
$formatter = new Formatter( $assoc_args, $fields );
$formatter->display_items( $application_passwords );
}
}
Expand Down

0 comments on commit 248cbb9

Please sign in to comment.