Skip to content

Commit

Permalink
Use output_name as default title
Browse files Browse the repository at this point in the history
The CLI handling code was redesigned for v0.4 and it seems the code
to assign a default title from v0.3.1 has been messed up. This bug
has not been triggered by build_examples.py due to it seems to call
the parse() function differently.

The output_name should be used as default title when present.

This will fix the #360 bug report.
  • Loading branch information
kvid committed May 24, 2024
1 parent 954c4f5 commit 5e6fc4b
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/wireviz/wireviz.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
smart_file_resolve,
)

from . import APP_NAME


def parse(
inp: Union[Path, str, Dict],
Expand Down Expand Up @@ -117,10 +119,7 @@ def parse(

# When title is not given, either deduce it from filename, or use default text.
if "title" not in harness.metadata:
if yaml_file is None:
harness.metadata["title"] = "WireViz diagram and BOM"
else:
harness.metadata["title"] = Path(yaml_file).stem
harness.metadata["title"] = output_name or f"{APP_NAME} diagram and BOM"

# add items
# parse YAML input file ====================================================
Expand Down

0 comments on commit 5e6fc4b

Please sign in to comment.