From 5b7ef04d0d4afc5041c71b12c1c00a56dd686527 Mon Sep 17 00:00:00 2001 From: Christophe Benz Date: Thu, 8 Apr 2010 12:17:50 +0200 Subject: [PATCH] display simpler message if no coming operations, instead of empty table --- weboob/frontends/boobank/scripts/boobank | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/weboob/frontends/boobank/scripts/boobank b/weboob/frontends/boobank/scripts/boobank index b7ca0782d9..f985813065 100755 --- a/weboob/frontends/boobank/scripts/boobank +++ b/weboob/frontends/boobank/scripts/boobank @@ -53,6 +53,7 @@ class Boobank(ConsoleApplication): @ConsoleApplication.command('Display all future operations') def command_coming(self, id): + operations = [] found = 0 for name, backend in self.weboob.iter_backends(): try: @@ -61,18 +62,19 @@ class Boobank(ConsoleApplication): if found == 0: found = -1 else: - if found == 0: - print ' Date Label Amount ' - print '+----------+----------------------------------------------------+-------------+' - found = 1 for operation in backend.iter_operations(account): - print ' %8s %-50s %11.2f' % (operation.date, - operation.label, - operation.amount) + operations.append(' %8s %-50s %11.2f' % (operation.date, operation.label, operation.amount)) if found < 0: print >>sys.stderr, "Error: account %s not found" % id return 1 + else: + if operations: + print ' Date Label Amount ' + print '+----------+----------------------------------------------------+-------------+' + print '\n'.join(operations) + else: + print 'No coming operations for ID=%s' % id if __name__ == '__main__': Boobank.run() -- GitLab