Skip to content

Commit

Permalink
Add alignments to table
Browse files Browse the repository at this point in the history
  • Loading branch information
rolf-yoast committed Apr 19, 2024
1 parent 41b502b commit 925732a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/DB_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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(
Expand All @@ -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 );
Expand Down

0 comments on commit 925732a

Please sign in to comment.