admin管理员组

文章数量:1122846

First of, I'm not sure what the correct technical name is for this.

The problem is the display width for the first column (or maybe total table width) on commands like

wp plugin list

and it outputs the installed plugins in a code table thing, like so:

+---------------------------------------+----------+--------+------------+
| name                                  | status   | update | version    |
+---------------------------------------+----------+--------+------------+
| tinymce-advanced                      | active   | none   | 5.6.0      |
| anual-archive                         | active   | none   | 1.5.5      |

So what I'm trying to do is set (force) the width for the first column wider, in this case 'name'.

I'm not sure if it's an update to wp-cli that has changed the behaviour, but now, no matter how wide I set my putty window, the output columns are narrower and wrapping.

I use the output for reports and changelogs and the wrapping messes everything up, display wise.

This is an example of what is happeing now:

| black-studio-tinymce-wi | active   | available                  | 2.7.0      |
| dget                    |          |                            |            |
| classic-editor          | active   | none                       | 1.6.2      |

where in the past, the first would go wider and be more legible:

| media-library-plus/media-library-plus | inactive | none   | 8.0.1      |
| media-library-plus/mlp-reset          | inactive | none   | 8.0.1      |

not line breaking and wrapping.

Sometimes the 'update' (3rd) column would have | version higher than expect | somewhere and that would cause the same problem, like so:

| gravityforms            | active   | version higher than expect | 2.6        |
|                         |          | ed                         |            |
| gravityformsmailchimp   | inactive | none                       | 5.0        |

Ideally, I would like to say, don't wrap any lines (only for table outputs) and that way the output display can be all single lines per item.

I can't find documentation on setting the column width or total widths. I've already set putty window to 148 characters and that's not making a difference anymore.

Using wp-cli v 2.6 and Pageant 0.76 putty .

First of, I'm not sure what the correct technical name is for this.

The problem is the display width for the first column (or maybe total table width) on commands like

wp plugin list

and it outputs the installed plugins in a code table thing, like so:

+---------------------------------------+----------+--------+------------+
| name                                  | status   | update | version    |
+---------------------------------------+----------+--------+------------+
| tinymce-advanced                      | active   | none   | 5.6.0      |
| anual-archive                         | active   | none   | 1.5.5      |

So what I'm trying to do is set (force) the width for the first column wider, in this case 'name'.

I'm not sure if it's an update to wp-cli that has changed the behaviour, but now, no matter how wide I set my putty window, the output columns are narrower and wrapping.

I use the output for reports and changelogs and the wrapping messes everything up, display wise.

This is an example of what is happeing now:

| black-studio-tinymce-wi | active   | available                  | 2.7.0      |
| dget                    |          |                            |            |
| classic-editor          | active   | none                       | 1.6.2      |

where in the past, the first would go wider and be more legible:

| media-library-plus/media-library-plus | inactive | none   | 8.0.1      |
| media-library-plus/mlp-reset          | inactive | none   | 8.0.1      |

not line breaking and wrapping.

Sometimes the 'update' (3rd) column would have | version higher than expect | somewhere and that would cause the same problem, like so:

| gravityforms            | active   | version higher than expect | 2.6        |
|                         |          | ed                         |            |
| gravityformsmailchimp   | inactive | none                       | 5.0        |

Ideally, I would like to say, don't wrap any lines (only for table outputs) and that way the output display can be all single lines per item.

I can't find documentation on setting the column width or total widths. I've already set putty window to 148 characters and that's not making a difference anymore.

Using wp-cli v 2.6 and Pageant 0.76 putty .

Share Improve this question asked Oct 17, 2022 at 2:50 pietpiet 1314 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

While we do not have a global value we can set for the table column widths, there is a work around for the display problem.

The solution is to use the --fields switch that is available on many wp cli commands. For example we can drop one column, say the default 'status' with

wp plugin list --fields=name,version,update_version
+-----------------------------+----------+----------------+
| name                        | version  | update_version |
+-----------------------------+----------+----------------+
| tinymce-advanced            | 5.9.2    |                |
| black-studio-tinymce-widget | 2.7.3    |                |
| classic-editor              | 1.6.4    |                |

or change the columns and swap the order even with

wp plugin list --fields=name,version,status
+-----------------------------+----------+----------+
| name                        | version  | status   |
+-----------------------------+----------+----------+
| tinymce-advanced            | 5.9.2    | active   |
| black-studio-tinymce-widget | 2.7.3    | active   |
| classic-editor              | 1.6.4    | active   |
| classic-widgets             | 0.3      | active   |

from the standard, which is now including even more

+-----------------------------+----------+-----------+----------+----------------+-------------+
| name                        | status   | update    | version  | update_version | auto_update |
+-----------------------------+----------+-----------+----------+----------------+-------------+
| tinymce-advanced            | active   | none      | 5.9.2    |                | off         |
| black-studio-tinymce-widget | active   | none      | 2.7.3    |                | off         |
| classic-editor              | active   | none      | 1.6.4    |                | off         |

本文标签: wp cliwpcli output 39column display format39wrapping