cleo icon indicating copy to clipboard operation
cleo copied to clipboard

get_helper_set().get('table') not working in version 0.5

Open onema opened this issue 8 years ago • 2 comments

Just updated to version 0.5.0 and the following code is throwing an error:

table = self.get_helper_set().get('table')

I'm not sure if this is was by design or not.

I have updated it with the following:

from cleo.helpers.table_helper import TableHelper
table = Table(output)

also

table.set_layout(TableHelper.LAYOUT_COMPACT)

doesn't seem has been removed. Didn't find anything in the docs related to how to upgrade or what to replace this code with.

Thank you for working on this library!

onema avatar Sep 21 '16 23:09 onema

I started using

table.set_style('compact')

to set the proper layout. saw it in the tests :)

onema avatar Sep 21 '16 23:09 onema

Yes, a lot has changed in this version and some changes breaks the previous API. Sorry about that :-(

Please referer to the change log to see what has changed exactly: https://github.com/sdispater/cleo/blob/master/CHANGELOG.md

Anyway, you should no longer rely on the TableHelper that will eventually be removed but you should use the Table class instead.

Also, it's no longer necessary to call the helpers directly or via self.get_helper_set().get() since commands now have handy methods to use these helpers more easily. Check out the helpers docs to see how: http://cleo.readthedocs.io/en/latest/helpers/index.html

Basically, to get a Table instance inside the handle() method of the Command you just have to call self.table().  

sdispater avatar Sep 22 '16 03:09 sdispater

This is a really old issue and it seems to have a viable answer. Closing.

Secrus avatar Sep 05 '22 20:09 Secrus