threefoldtecharchive / jumpscaleX_core

Apache License 2.0
1 stars 6 forks source link

Refactor __repr__ that uses print statement to print ansi colors #169

Closed abom closed 4 years ago

abom commented 4 years ago

In some places, we use print statement inside __repr__ to print ansi colors, this is too much annoying while e.g. typing in kosmos shell, as characters are printed everywhere.

For example in JSXObject.py:

    def __repr__(self):
        # FIXME: breaks in some cases in docsites generation needs to be cleanly implemented
        out = self._str_get(ansi=True)
        # # #TODO: *1 when returning the text it does not represent propertly, needs to be in kosmos shell I think
        # # IS UGLY WORKAROUND
        print(out)
        return ""

prompt-toolkit support printing formatted text, so, this seems to be resolvable.

siddiquagig commented 4 years ago

Works

Typed in kosmos bcdb = j.data.bcdb.WebDavProvider

image

abom commented 4 years ago

@siddiquagig Can you please test the colors is printed if you did the following for example?

j.clients.gedis.main_gedis_threebot

siddiquagig commented 4 years ago

Verified , colors are printed

image