Skip to content

Commit f692420

Browse files
committed
⚡️ Add formatting improvements
1 parent 9eadcb4 commit f692420

File tree

3 files changed

+603
-594
lines changed

3 files changed

+603
-594
lines changed

src/simvue_cli/cli/__init__.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,12 +133,15 @@ def about_simvue(ctx) -> None:
133133
"""Display full information on Simvue instance"""
134134
width = shutil.get_terminal_size().columns
135135
click.echo(
136-
"\n".join(f"{'\t' * int(0.015 * width)}{r}" for r in SIMVUE_LOGO.split("\n"))
136+
"\n".join("\t" * int(0.015 * width) + f"{r}" for r in SIMVUE_LOGO.split("\n"))
137137
)
138138
click.echo(f"\n{width * '='}\n")
139-
click.echo(f"\n{'\t' * int(0.04 * width)} Provided under the Apache-2.0 License")
140139
click.echo(
141-
f"{'\t' * int(0.04 * width)}© Copyright {datetime.datetime.now().strftime('%Y')} Simvue Development Team\n"
140+
"\n" + "\t" * int(0.04 * width) + "Provided under the Apache-2.0 License"
141+
)
142+
click.echo(
143+
"\t" * int(0.04 * width)
144+
+ f"© Copyright {datetime.datetime.now().strftime('%Y')} Simvue Development Team\n"
142145
)
143146
out_table: list[list[str]] = []
144147
with contextlib.suppress(importlib.metadata.PackageNotFoundError):
@@ -156,7 +159,7 @@ def about_simvue(ctx) -> None:
156159
out_table.append(["Server Version: ", server_version])
157160
click.echo(
158161
"\n".join(
159-
f"{'\t' * int(0.045 * width)}{r}"
162+
"\t" * int(0.045 * width) + f"{r}"
160163
for r in tabulate.tabulate(out_table, tablefmt="plain")
161164
.__str__()
162165
.split("\n")

src/simvue_cli/cli/display.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,12 @@ def create_objects_display(
191191
row.append(str(i))
192192

193193
for column in columns:
194-
value = getattr(obj, column, "N/A")
194+
# FIXME: Hack for if a property has not been added to the API yet
195+
if not (value := getattr(obj, column, None)):
196+
try:
197+
value = obj._get_attribute(column)
198+
except KeyError:
199+
value = "N/A"
195200
if formatter := COLUMN_FORMAT.get(column):
196201
row.append(formatter(value, plain_text, out_config))
197202
else:

0 commit comments

Comments
 (0)