Skip to content

Is it possible to enhance table format with right-align numeric values easily? #239

Description

@Reiner030

because the length is already calculated / formatted correctly but is very unhandy to check/read while numbers are left-aligned like here:

root@test-server ~ # sudo -u www-data -s -- wp db size --path=/path/to/wordpress/staging/current --tables
+-----------------------+--------------+
| Name                  | Size         |
+-----------------------+--------------+
| wp_commentmeta        | 49152 B      |
| wp_comments           | 98304 B      |
| wp_links              | 32768 B      |
| wp_options            | 4751360 B    |
| wp_postmeta           | 2267021312 B |
| wp_posts              | 46792704 B   |
| wp_term_relationships | 3178496 B    |
| wp_term_taxonomy      | 507904 B     |
| wp_termmeta           | 950272 B     |
| wp_terms              | 573440 B     |
| wp_usermeta           | 425984 B     |
| wp_users              | 65536 B      |
+-----------------------+--------------+

As far I can see the table output is triggered in
https://github.com/wp-cli/db-command/blob/master/src/DB_Command.php#L875-L876

and uses Formatter object/functions (without orderby / include_totals) of this module:
https://github.com/wp-cli/profile-command/blob/master/inc/class-formatter.php#L77

(but not sure - normally using no PHP as system administrator 😄)

Activity

  1. swissspidy commented on Aug 10, 2023

    @swissspidy
    Member

    Looking at wp-cli/php-cli-tools#121 and wp-cli/php-cli-tools#120, it seems like it should be possible. Just a matter of making this available for this command (and others) via wp-cli/wp-cli.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions