From dcd372b3bf8a40e737eb3ed9071c50bd29fb111e Mon Sep 17 00:00:00 2001 From: Moul <moul@moul.re> Date: Fri, 14 May 2021 15:36:49 +0200 Subject: [PATCH] [mod] #402: history: Get terminal columns with shutil instead of click Change from click.get_terminal_size() to shutil.get_terminal_size() Numbers of columns can be accessed with: the first element `[0]` and .columns attribute --- silkaj/tx_history.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/silkaj/tx_history.py b/silkaj/tx_history.py index c7de2ce4..466798cf 100644 --- a/silkaj/tx_history.py +++ b/silkaj/tx_history.py @@ -15,9 +15,10 @@ You should have received a copy of the GNU Affero General Public License along with Silkaj. If not, see <https://www.gnu.org/licenses/>. """ +import shutil from operator import eq, itemgetter, ne, neg -from click import argument, command, echo_via_pager, get_terminal_size, option +from click import argument, command, echo_via_pager, option from duniterpy.api.bma.tx import history from duniterpy.documents.transaction import Transaction from pendulum import from_timestamp, now @@ -53,7 +54,7 @@ async def transaction_history(pubkey, uids, full_pubkey): txs_list = await generate_table( received_txs, sent_txs, pubkey, ud_value, currency_symbol, uids, full_pubkey ) - table = Texttable(max_width=get_terminal_size()[0]) + table = Texttable(max_width=shutil.get_terminal_size().columns) table.add_rows(txs_list) await client.close() echo_via_pager(header + table.draw()) -- GitLab