print header only if needed
This commit is contained in:
parent
67dc423f0a
commit
69d7d970c1
1 changed files with 8 additions and 4 deletions
|
|
@ -38,17 +38,21 @@ class Boobank(ConsoleApplication):
|
||||||
|
|
||||||
@ConsoleApplication.command('List every available accounts')
|
@ConsoleApplication.command('List every available accounts')
|
||||||
def command_list(self):
|
def command_list(self):
|
||||||
lines = [' ID Account Balance Coming ',
|
accounts = []
|
||||||
'+-----------------+---------------------+--------------+-------------+']
|
|
||||||
for name, backend, in self.weboob.iter_backends():
|
for name, backend, in self.weboob.iter_backends():
|
||||||
try:
|
try:
|
||||||
for account in backend.iter_accounts():
|
for account in backend.iter_accounts():
|
||||||
lines.append('%17s %-20s %11.2f %11.2f' % (
|
accounts.append('%17s %-20s %11.2f %11.2f' % (
|
||||||
account.id, account.label, account.balance, account.coming))
|
account.id, account.label, account.balance, account.coming))
|
||||||
except weboob.tools.browser.BrowserIncorrectPassword:
|
except weboob.tools.browser.BrowserIncorrectPassword:
|
||||||
print >>sys.stderr, 'Error: Incorrect password for backend %s' % name
|
print >>sys.stderr, 'Error: Incorrect password for backend %s' % name
|
||||||
return 1
|
return 1
|
||||||
print '\n'.join(lines)
|
if len(accounts):
|
||||||
|
print ' ID Account Balance Coming '
|
||||||
|
print '+-----------------+---------------------+--------------+-------------+'
|
||||||
|
print '\n'.join(accounts)
|
||||||
|
else:
|
||||||
|
print 'No accounts found'
|
||||||
|
|
||||||
@ConsoleApplication.command('Display all future operations')
|
@ConsoleApplication.command('Display all future operations')
|
||||||
def command_coming(self, id):
|
def command_coming(self, id):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue