Robpol86 / terminaltables

Project no longer maintained.
https://github.com/matthewdeanmartin/terminaltables
MIT License
689 stars 70 forks source link

Created PorcelainTable class #31

Closed liiight closed 8 years ago

liiight commented 8 years ago

Added a class that'll emulate git --porcelain option, useful for stuff (at least I'll use it :smile: ).

from terminaltables.other_tables import PorcelainTable

table_data = [
    ['Heading1', 'Heading2'],
    ['row1 column1', 'row1 column2'],
    ['row2 column1', 'row2 column2'],
    ['row3 column1', 'row3 column2']
]
table = PorcelainTable(table_data)
print (table.table)

 Heading1     | Heading2     
 row1 column1 | row1 column2 
 row2 column1 | row2 column2 
 row3 column1 | row3 column2 
coveralls commented 8 years ago

Coverage Status

Coverage decreased (-0.9%) to 98.925% when pulling 16b2b59d9d87bb7c1c3ec60500d78db8fe395f50 on liiight:master into 6f209ed33a4628facf24f35bef70c82f8521d744 on Robpol86:master.

Robpol86 commented 8 years ago

Can you add tests to this, similar to the GitHub table tests?

liiight commented 8 years ago

Yeah, sure. Sorry for not doing this upfront. Also, I'll add the table to the main init.py

coveralls commented 8 years ago

Coverage Status

Coverage increased (+0.003%) to 99.785% when pulling 8dc71ccade8fa7fd1ee1d7e0c949ecd4532bcb64 on liiight:master into 6f209ed33a4628facf24f35bef70c82f8521d744 on Robpol86:master.

liiight commented 8 years ago

Dunno why build failed, probably took too long. I suggest triggering different build for each py version, it'll be faster (Travis can run simultaneously).

Also another thing. Ideally PorcelainTable should not show any colors. I do this now in my soltuion using some partial hackery. Ideally, this should/could be baked in BaseTable using a allow_colors flag that can be checked when generating the table. This however means coupling terminaltables with a color library (let's say, colorclass for example :wink: ). I'm more than willing to make that PR, just not sure if that's something you want/agree with.

Robpol86 commented 8 years ago

Ugh, why did that break. I'll look into why ssh-add is prompting for a password for an ssh key with no password set. Your PR looks fine so I'll merge it.

I can't run multiple Travis jobs per build because Coveralls.io doesn't combine coverage from Travis and AppVeyor. I have to combine all coverage myself and then send it from Travis once.

The colors thing is a bit out of scope for terminaltables. If you want to remove colors I would do it in your application. Either regex strip it out before passing strings to terminaltables or use colorclass which can strip colors.

liiight commented 8 years ago

Thanks. I just check if I pass table type as porcelain and if so just not apply color: https://github.com/Flexget/Flexget/pull/1307/files#diff-487b1eb870fb818194584ff5fe02f66cR511 There's another topic I'd like to discuss, word wrapping when needed. Not sure if this is the best forum though.

Robpol86 commented 8 years ago

There's an issue for that: https://github.com/Robpol86/terminaltables/issues/5

liiight commented 8 years ago

Cool. Word wrap is very tricky as it involves many design decisions (which column to wrap, etc.)

When is a new version expected to be released?

Robpol86 commented 8 years ago

Probably not for a long time unfortunately. I've got one or two other projects I want to work on before taking care of more issues here. Maybe in a month I can consider making a quick release.

liiight commented 8 years ago

Well with your coverage I'd consider just doing ci. I'll keep an eye out for release though, thanks!

Robpol86 commented 7 years ago

FYI I've just released a new version.

liiight commented 7 years ago

nice, thanks for the heads up!