Created
August 10, 2019 14:12
-
-
Save jfly/a2e2c01e0d86f2f8235f6c1ef9898637 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from cli_helpers.tabular_output import TabularOutputFormatter | |
formatter = TabularOutputFormatter(format_name='simple') | |
headers = ("Column A", "Column B") | |
so_much_b_data = "\n".join(str(i)*50 for i in range(10)) | |
data = [ ("some a data", so_much_b_data) ] | |
format = "ascii" | |
print("\n".join(list(formatter.format_output(data, headers, format)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When I run this, I see the following:
(note that the
9
s are truncated, rather than showing all 50 of them)https://cli-helpers.readthedocs.io/en/stable/api.html#cli_helpers.tabular_output.preprocessors.truncate_string says:
This feels pretty weird to me... I think they might be right about long strings with no newlines, but long that aren't actually very wide but have a lot of newlines in them instead seem pretty reasonable to me...