olekukonko / tablewriter

ASCII table in golang
MIT License
4.28k stars 359 forks source link

Support UTF-8 table symbols #197

Closed aaabramov closed 1 year ago

aaabramov commented 2 years ago

What do you think of adding support for UTF-8 table symbols? At first sight, it could be easily added as a render option.

But also we would need to properly assign corner and center symbols like ╔, ╬, ╣. But I think it would be a fantastic addition!

Unfortunately, I am not strong enough in Go to open a PR for this :(

Example:

╔═════════════════════╦═══════════════════════╗
║      Old name       ║       New name        ║
╠═════════════════════╬═══════════════════════╣
║ findOne(…)          ║ findById(…)           ║
╠═════════════════════╬═══════════════════════╣
║ save(Iterable)      ║ saveAll(Iterable)     ║
╠═════════════════════╬═══════════════════════╣
║ findAll(Iterable)   ║ findAllById(…)        ║
╠═════════════════════╬═══════════════════════╣
║ delete(ID)          ║ deleteById(ID)        ║
╠═════════════════════╬═══════════════════════╣
║ delete(Iterable)    ║ deleteAll(Iterable)   ║
╠═════════════════════╬═══════════════════════╣
║ exists()            ║ existsById(…)         ║
╚═════════════════════╩═══════════════════════╝

Possible combinations:

heavy            heavy + light    light            double-lined
┏━━━━━━┳━━━━━━┓  ┏━━━━━━┯━━━━━━┓  ┌──────┬──────┐  ╔══════╦══════╗
┃ col1 ┃ col2 ┃  ┃ col1 │ col2 ┃  │ col1 │ col2 │  ║ col1 ║ col2 ║
┣━━━━━━╋━━━━━━┫  ┠──────┼──────┨  ├──────┼──────┤  ╠══════╬══════╣
┃ val1 ┃ val2 ┃  ┃ val1 │ val2 ┃  │ val1 │ val2 │  ║ val1 ║ val2 ║
┗━━━━━━┻━━━━━━┛  ┗━━━━━━┷━━━━━━┛  └──────┴──────┘  ╚══════╩══════╝

Here is how it could look like: image

craigbox commented 1 year ago

See https://github.com/olekukonko/tablewriter/pull/207 for an implementation.