| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1484,12 +1484,16 @@ public function search( $args, $assoc_args ) { | |||
| 1484 | 1484 | ||
| 1485 | 1485 | if ( $format ) { | |
| 1486 | 1486 | $search_results[] = [ | |
| 1487 | - 'table' => $table, | ||
| 1488 | - 'column' => $column, | ||
| 1489 | - 'key' => $primary_key, | ||
| 1490 | - 'value' => $result->$primary_key, | ||
| 1487 | + 'table' => $table, | ||
| 1488 | + 'column' => $column, | ||
| 1491 | 1489 | // Remove the colors for the format output. | |
| 1492 | - 'match' => str_replace( [ $colors['match'][0], $colors['match'][1] ], [ '', '' ], $col_val ), | ||
| 1490 | + 'match' => str_replace( | ||
| 1491 | + [ $colors['match'][0], $colors['match'][1] ], | ||
| 1492 | + [ '','' ], | ||
| 1493 | + $col_val | ||
| 1494 | + ), | ||
| 1495 | + 'primary_key_name' => $primary_key, | ||
| 1496 | + 'primary_key_value' => $result->$primary_key, | ||
| 1493 | 1497 | ]; | |
| 1494 | 1498 | } else { | |
| 1495 | 1499 | WP_CLI::log( $matches_only ? $col_val : ( $one_line ? "{$table_column_val}:{$pk_val}{$col_val}" : "{$pk_val}{$col_val}" ) ); | |
@@ -1504,7 +1508,7 @@ public function search( $args, $assoc_args ) { | |||
| 1504 | 1508 | $formatter_args = [ | |
| 1505 | 1509 | 'format' => $format, | |
| 1506 | 1510 | ]; | |
| 1507 | - $formatter_fields = [ 'table', 'column', 'key', 'value', 'match' ]; | ||
| 1511 | + $formatter_fields = [ 'table', 'column', 'match', 'primary_key_name', 'primary_key_value' ]; | ||
| 1508 | 1512 | ||
| 1509 | 1513 | if ( $fields ) { | |
| 1510 | 1514 | $fields = explode( ',', $assoc_args['fields'] ); | |
@@ -1515,7 +1519,7 @@ public function search( $args, $assoc_args ) { | |||
| 1515 | 1519 | if ( count( $tables ) > 1 ) { | |
| 1516 | 1520 | WP_CLI::error( 'The "ids" format can only be used for a single table.' ); | |
| 1517 | 1521 | } | |
| 1518 | - $search_results = array_column( $search_results, 'value' ); | ||
| 1522 | + $search_results = array_column( $search_results, 'primary_key_value' ); | ||
| 1519 | 1523 | } | |
| 1520 | 1524 | ||
| 1521 | 1525 | $formatter = new Formatter( $formatter_args, $formatter_fields ); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments