mycli icon indicating copy to clipboard operation
mycli copied to clipboard

set column max_width

Open potoo0 opened this issue 3 years ago • 0 comments

Is it possible to support setting maximum width for column?

example: org result:

+----+-------+---------------------+---------------------+---------+--------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| id | job_name | start_time          | end_time            | elapsed | status | details                                                                                                                                                           

      |
+----+-------+---------------------+---------------------+---------+--------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| 9  | test01   | 2021-04-22 17:16:30 | 2021-04-22 17:16:30 | 0s      | failed | 2021-04-22 17:16:30,320 - test01 - e:\algo_factory\logtodb\test.py[line:23]-WARNING: msg1\n2021-04-22 17:16:30,321 - test01 - e:\algo_factory\logtodb\test.py[line:24]-WARNING: msg2\n2021-04-22 17:16:30,321 - test01 - e:\algo_factory\logtodb\test.py[line:28]-ERROR: 1 / 0\nTraceback (most recent call last):\n  File "e:\algo_factory\logtodb\test.py", line 26, in main\n    1 / 0\nZeroDivisionError: division by zero\n |
| 10 | test02   | 2021-04-22 17:16:55 | 2021-04-22 17:16:55 | 2s      | failed | 2021-04-22 17:16:54,827 - test02 - e:\algo_factory\logtodb\test.py[line:23]-WARNING: msg1\n2021-04-22 17:16:54,827 - test02 - e:\algo_factory\logtodb\test.py[line:24]-WARNING: msg2\n2021-04-22 17:16:54,828 - test02 - e:\algo_factory\logtodb\test.py[line:28]-ERROR: 1 / 0\nTraceback (most recent call last):\n  File "e:\algo_factory\logtodb\test.py", line 26, in main\n    1 / 0\nZeroDivisionError: division by zero\n |
+----+-------+---------------------+---------------------+---------+--------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

Expect the output after setting max_width=19:

+----+-------+---------------------+---------------------+---------+--------+---------------------+
| id | job_name | start_time          | end_time            | elapsed | status | details    |
+----+-------+---------------------+---------------------+---------+--------+---------------------+
| 9  | test01   | 2021-04-22 17:16:30 | 2021-04-22 17:16:30 | 0s      | failed | 2021-04-22 17:16... |
| 10 | test02   | 2021-04-22 17:16:55 | 2021-04-22 17:16:55 | 2s      | failed | 2021-04-22 17:16... |
+----+-------+---------------------+---------------------+---------+--------+---------------------+

potoo0 avatar Jun 21 '21 06:06 potoo0