From 32a62a6dd76b27541ba7fe9e0ae03861877e8424 Mon Sep 17 00:00:00 2001 From: Daniel Rojas Date: Sat, 1 Mar 2025 18:17:54 +0100 Subject: [PATCH] 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. Co-authored-by: kvid --- src/wireviz/wireviz.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/wireviz/wireviz.py b/src/wireviz/wireviz.py index 834b8a7..a1a3439 100755 --- a/src/wireviz/wireviz.py +++ b/src/wireviz/wireviz.py @@ -21,6 +21,8 @@ from wireviz.wv_utils import ( smart_file_resolve, ) +from . import APP_NAME + def parse( inp: Union[Path, str, Dict], @@ -118,9 +120,7 @@ def parse( # When title is not given, either deduce it from filename, or use default text. if "title" not in harness.metadata: - harness.metadata["title"] = ( - Path(yaml_file).stem if yaml_file else "WireViz diagram and BOM" - ) + harness.metadata["title"] = output_name or f"{APP_NAME} diagram and BOM" # add items # parse YAML input file ====================================================