Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

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

Open
Reiner030 opened this issue Aug 2, 2018 · 1 comment · May be fixed by #252, wp-cli/php-cli-tools#171 or wp-cli/wp-cli#5934

Comments

@Reiner030
Copy link

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 😄)

@swissspidy swissspidy transferred this issue from wp-cli/profile-command Aug 10, 2023
@swissspidy
Copy link
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.

# for free to join this conversation on GitHub. Already have an account? # to comment