From 7b23ee9c7c5c774b16d8f2af84abc27f1944c9b1 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Mon, 15 Nov 2021 10:25:00 -0500 Subject: [PATCH] Organize squeeze vertically The web gui and ls on cli use organize output this way, so squeezed node output should be same. --- confluent_client/confluent/screensqueeze.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/confluent_client/confluent/screensqueeze.py b/confluent_client/confluent/screensqueeze.py index ec4b809e..0b863102 100644 --- a/confluent_client/confluent/screensqueeze.py +++ b/confluent_client/confluent/screensqueeze.py @@ -65,15 +65,17 @@ class ScreenPrinter(object): else: numfields = 1 fieldformat = '{0}: {1}' - currfields = 0 - for node in self.nodelist: - if currfields >= numfields: + if self.squeeze: + columns = [self.nodelist[x:x+currheight] for x in range(0, len(self.nodelist), currheight)] + for currow in range(0, len(columns[0])): + for col in columns: + node = col[currow] + sys.stdout.write(fieldformat.format(node, self.nodeoutput[node])) + sys.stdout.write('\n') + else: + for node in self.nodelist: + sys.stdout.write(fieldformat.format(node, self.nodeoutput[node])) sys.stdout.write('\n') - currfields = 1 - else: - currfields += 1 - sys.stdout.write(fieldformat.format(node, self.nodeoutput[node])) - sys.stdout.write('\n') sys.stdout.flush()