@@ -772,6 +772,8 @@ public function size( $args, $assoc_args ) {
772772 $ human_readable = WP_CLI \Utils \get_flag_value ( $ assoc_args , 'human-readable ' , false );
773773 $ tables = WP_CLI \Utils \get_flag_value ( $ assoc_args , 'tables ' );
774774 $ tables = ! empty ( $ tables );
775+ $ all_tables = WP_CLI \Utils \get_flag_value ( $ assoc_args , 'all-tables ' );
776+ $ all_tables_with_prefix = WP_CLI \Utils \get_flag_value ( $ assoc_args , 'all-tables-with-prefix ' );
775777
776778 if ( ! is_null ( $ size_format ) && $ human_readable ) {
777779 WP_CLI ::error ( "Cannot use --size_format and --human-readable arguments at the same time. " );
@@ -792,7 +794,7 @@ public function size( $args, $assoc_args ) {
792794
793795 $ default_unit = ( empty ( $ size_format ) && ! $ human_readable ) ? ' B ' : '' ;
794796
795- if ( $ tables ) {
797+ if ( $ tables || $ all_tables || $ all_tables_with_prefix ) {
796798
797799 // Add all of the table sizes
798800 foreach ( WP_CLI \Utils \wp_get_table_names ( $ args , $ assoc_args ) as $ table_name ) {
@@ -900,7 +902,7 @@ public function size( $args, $assoc_args ) {
900902 }
901903 }
902904
903- if ( ! empty ( $ size_format ) && ! $ tables && ! $ format && ! $ human_readable ) {
905+ if ( ! empty ( $ size_format ) && ! $ tables && ! $ format && ! $ human_readable && true !== $ all_tables && true !== $ all_tables_with_prefix ) {
904906 WP_CLI ::Line ( filter_var ( $ rows [0 ]['Size ' ], FILTER_SANITIZE_NUMBER_INT ) );
905907 } else {
906908 // Display the rows.
0 commit comments