rails / thor

Thor is a toolkit for building powerful command-line interfaces.
http://whatisthor.com/
MIT License
5.14k stars 553 forks source link

Add support for printing tables with borders #855

Closed p8 closed 1 year ago

p8 commented 1 year ago

Adding borders to tables can improve their legibility.

Before

  Name  Number  Color
  Erik       1  green
  Ruby       2  red 

After with borders: true

+------+--------+-------+
| Name | Number | Color |
+------+--------+-------+
| Erik |      1 | green |
| Ruby |      2 | red   |
+------+--------+-------+

This would allow replacing the custom table for code statistics in Rails, with the generic implementation in Thor.

By adding :separators to a table a horizontal separator will be added. This functionality was inspired by: https://github.com/piotrmurach/tty-table Having the ability to add separators where required adds more flexibility instead of having headers and footers.

Builds on: https://github.com/rails/thor/pull/854