display simpler message if no coming operations, instead of empty table
This commit is contained in:
parent
1c99c105c2
commit
5b7ef04d0d
1 changed files with 9 additions and 7 deletions
|
|
@ -53,6 +53,7 @@ class Boobank(ConsoleApplication):
|
||||||
|
|
||||||
@ConsoleApplication.command('Display all future operations')
|
@ConsoleApplication.command('Display all future operations')
|
||||||
def command_coming(self, id):
|
def command_coming(self, id):
|
||||||
|
operations = []
|
||||||
found = 0
|
found = 0
|
||||||
for name, backend in self.weboob.iter_backends():
|
for name, backend in self.weboob.iter_backends():
|
||||||
try:
|
try:
|
||||||
|
|
@ -61,18 +62,19 @@ class Boobank(ConsoleApplication):
|
||||||
if found == 0:
|
if found == 0:
|
||||||
found = -1
|
found = -1
|
||||||
else:
|
else:
|
||||||
if found == 0:
|
|
||||||
print ' Date Label Amount '
|
|
||||||
print '+----------+----------------------------------------------------+-------------+'
|
|
||||||
|
|
||||||
found = 1
|
found = 1
|
||||||
for operation in backend.iter_operations(account):
|
for operation in backend.iter_operations(account):
|
||||||
print ' %8s %-50s %11.2f' % (operation.date,
|
operations.append(' %8s %-50s %11.2f' % (operation.date, operation.label, operation.amount))
|
||||||
operation.label,
|
|
||||||
operation.amount)
|
|
||||||
if found < 0:
|
if found < 0:
|
||||||
print >>sys.stderr, "Error: account %s not found" % id
|
print >>sys.stderr, "Error: account %s not found" % id
|
||||||
return 1
|
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__':
|
if __name__ == '__main__':
|
||||||
Boobank.run()
|
Boobank.run()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue