Skip to content

Commit

Permalink
fix arg structure
Browse files Browse the repository at this point in the history
  • Loading branch information
s-m-e committed Feb 9, 2022
1 parent 3931b76 commit 9cd1c3b
Showing 1 changed file with 29 additions and 30 deletions.
59 changes: 29 additions & 30 deletions src/scherbelberg/_cli/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,51 +38,50 @@
get_datacenters,
get_servertypes,
)
from .._core.const import (
TOKENVAR,
HETZNER_DATACENTER,
)
from .._core.const import TOKENVAR
from .._core.log import configure_log

# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# ROUTINES
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

@click.command(short_help="create cluster")
@click.command(short_help="list data centers and available servers types")
@click.option("-t", "--tokenvar", default=TOKENVAR, type=str, show_default=True)
@click.option(
"-d", "--datacenter", default=HETZNER_DATACENTER, type=str, show_default=True
)
@click.option("-l", "--log_level", default=ERROR, type=int, show_default=True)
@click.argument("datacenter", nargs=1, required=False)
def catalog(
tokenvar,
datacenter,
log_level,
datacenter,
):

configure_log(log_level)

table = run(get_datacenters(tokenvar = tokenvar))
columns = (
'name',
'city',
'country',
'description',
'latitude',
'longitude',
'network_zone',
'location_name',
'location_description',
)
table = [
[row[column] for column in columns]
for row in table
]
click.echo(tabulate(
table,
headers=columns,
tablefmt="github",
))
if datacenter is None:

table = run(get_datacenters(tokenvar = tokenvar))
columns = (
'name',
'city',
'country',
'description',
'latitude',
'longitude',
'network_zone',
'location_name',
'location_description',
)
table = [
[row[column] for column in columns]
for row in table
]
click.echo(tabulate(
table,
headers=columns,
tablefmt="github",
))

return

table = run(get_servertypes(datacenter = datacenter, tokenvar = tokenvar))
columns = (
Expand Down

0 comments on commit 9cd1c3b

Please sign in to comment.