wp-cli / php-cli-tools

A collection of tools to help with PHP command line utilities
MIT License
674 stars 118 forks source link

Missing $pad_type in Colors::pad() (str_pad) #121

Closed urlund closed 7 years ago

urlund commented 7 years ago

Trying to align numbers to the right in a cli table, but STR_PAD_LEFT seems to be missing.

Current ASCII table creates:

+----+------+---------+
| ID | Name | Balance |
+----+------+---------+
| 3  | Foo  | 10,00   |
| 10 | Bar  | 1200,00 |
+----+------+---------+
|    |      | 1210,00 |
+----+------+---------+

What I want is:

+----+------+---------+
| ID | Name | Balance |
+----+------+---------+
|  3 | Foo  |   10,00 |
| 10 | Bar  | 1200,00 |
+----+------+---------+
|    |      | 1210,00 |
+----+------+---------+

But Colors::pad() while extending ACSII table padColum does not have the possibility to provide STR_PAD_RIGHT or STR_PAD_LEFT based on the $column number.

Fixed in PR: #120