replace ugly tables with PrettyTables
This commit is contained in:
parent
ca25bbf388
commit
6df227e7e6
@ -8,7 +8,7 @@ import typer
|
|||||||
import os
|
import os
|
||||||
import configparser
|
import configparser
|
||||||
import base64
|
import base64
|
||||||
import prettytable
|
from prettytable import PrettyTable
|
||||||
|
|
||||||
app = typer.Typer()
|
app = typer.Typer()
|
||||||
servers_app = typer.Typer()
|
servers_app = typer.Typer()
|
||||||
@ -59,9 +59,11 @@ def get_balance():
|
|||||||
print(typer.style("Error", fg=typer.colors.RED))
|
print(typer.style("Error", fg=typer.colors.RED))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
else:
|
else:
|
||||||
|
x = PrettyTable()
|
||||||
|
x.field_names = ["Balance", "Monthly cost"]
|
||||||
response = response.json()
|
response = response.json()
|
||||||
print('{0:6} {1:}'.format('balance', 'monthly_cost'))
|
x.add_row([response['finances']['balance'], response['finances']['monthly_cost']])
|
||||||
print('{0:6} {1:}'.format(response['finances']['balance'], response['finances']['monthly_cost']))
|
print(x)
|
||||||
|
|
||||||
|
|
||||||
@servers_app.command("start")
|
@servers_app.command("start")
|
||||||
|
Loading…
Reference in New Issue
Block a user