Skip to content

Commit

Permalink
feat(CLI): echo full path of exported files (#79)
Browse files Browse the repository at this point in the history
for easier "debugging"

Co-authored-by: Konstantin <konstantin.klein+github@hochfrequenz.de>
  • Loading branch information
hf-kklein and Konstantin authored Oct 28, 2024
1 parent c6b1d35 commit 4b41bd8
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/ebd_toolchain/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,9 @@ def handle_known_error(error: Exception, ebd_key: str) -> None:
click.secho(f"Error while scraping {ebd_key}: {str(scraping_error)}; Skip!", fg="red")
continue
if "json" in export_types:
_dump_json(output_path / Path(f"{ebd_key}.json"), ebd_table)
click.secho(f"💾 Successfully exported '{ebd_key}.json'")
json_path = output_path / Path(f"{ebd_key}.json")
_dump_json(json_path, ebd_table)
click.secho(f"💾 Successfully exported '{ebd_key}.json' to {json_path.absolute()}")
try:
ebd_graph = convert_table_to_graph(ebd_table)
except (EbdCrossReferenceNotSupportedError, EndeInWrongColumnError, OutcomeCodeAmbiguousError) as known_issue:
Expand All @@ -145,8 +146,9 @@ def handle_known_error(error: Exception, ebd_key: str) -> None:
continue
if "puml" in export_types:
try:
_dump_puml(output_path / Path(f"{ebd_key}.puml"), ebd_graph)
click.secho(f"💾 Successfully exported '{ebd_key}.puml'")
puml_path = output_path / Path(f"{ebd_key}.puml")
_dump_puml(puml_path, ebd_graph)
click.secho(f"💾 Successfully exported '{ebd_key}.puml' to {puml_path.absolute()}")
except AssertionError as assertion_error:
# https://github.com/Hochfrequenz/rebdhuhn/issues/35
click.secho(str(assertion_error), fg="red")
Expand All @@ -157,11 +159,13 @@ def handle_known_error(error: Exception, ebd_key: str) -> None:

try:
if "dot" in export_types:
_dump_dot(output_path / Path(f"{ebd_key}.dot"), ebd_graph)
click.secho(f"💾 Successfully exported '{ebd_key}.dot'")
dot_path = output_path / Path(f"{ebd_key}.dot")
_dump_dot(dot_path, ebd_graph)
click.secho(f"💾 Successfully exported '{ebd_key}.dot' to {dot_path.absolute()}")
if "svg" in export_types:
_dump_svg(output_path / Path(f"{ebd_key}.svg"), ebd_graph)
click.secho(f"💾 Successfully exported '{ebd_key}.svg'")
svg_path = output_path / Path(f"{ebd_key}.svg")
_dump_svg(svg_path, ebd_graph)
click.secho(f"💾 Successfully exported '{ebd_key}.svg' to {svg_path.absolute()}")
except PathsNotGreaterThanOneError as known_issue:
handle_known_error(known_issue, ebd_key)
except AssertionError as assertion_error:
Expand Down

0 comments on commit 4b41bd8

Please sign in to comment.