From 925732a84c8f770ff171d7d6a2e36c135f152f6f Mon Sep 17 00:00:00 2001 From: Rolf <62988563+rolf-yoast@users.noreply.github.com> Date: Fri, 19 Apr 2024 08:16:03 +0200 Subject: [PATCH] Add alignments to table --- src/DB_Command.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/DB_Command.php b/src/DB_Command.php index 37e3bae7..07ebcf8f 100644 --- a/src/DB_Command.php +++ b/src/DB_Command.php @@ -2,6 +2,7 @@ use WP_CLI\Formatter; use WP_CLI\Utils; +use cli\table\Column; /** * Performs basic database operations using credentials stored in wp-config.php. @@ -1145,7 +1146,6 @@ public function size( $args, $assoc_args ) { if ( ! empty( $size_format ) && ! $tables && ! $format && ! $human_readable && true !== $all_tables && true !== $all_tables_with_prefix ) { WP_CLI::line( str_replace( " {$size_format_display}", '', $rows[0]['Size'] ) ); } else { - // Sort the rows by user input if ( $orderby ) { usort( @@ -1166,7 +1166,8 @@ function ( $a, $b ) use ( $order, $orderby ) { // Display the rows. $args = [ - 'format' => $format, + 'format' => $format, + 'alignments' => [ 'Size' => Column::ALIGN_RIGHT ], ]; $formatter = new Formatter( $args, $fields );