Use output_name as default title (#361)

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.
This commit is contained in:
KV 2024-05-23 17:52:32 +02:00
parent 982a1f6b2e
commit 26b70d49f9

View File

@ -20,6 +20,8 @@ from wireviz.wv_helper import (
smart_file_resolve, smart_file_resolve,
) )
from . import APP_NAME
def parse( def parse(
inp: Union[Path, str, Dict], inp: Union[Path, str, Dict],
@ -117,10 +119,7 @@ def parse(
# When title is not given, either deduce it from filename, or use default text. # When title is not given, either deduce it from filename, or use default text.
if "title" not in harness.metadata: if "title" not in harness.metadata:
if yaml_file is None: harness.metadata["title"] = output_name or f"{APP_NAME} diagram and BOM"
harness.metadata["title"] = "WireViz diagram and BOM"
else:
harness.metadata["title"] = Path(yaml_file).stem
# add items # add items
# parse YAML input file ==================================================== # parse YAML input file ====================================================