From 50ff1a046a742647a1af3abc5f035f643a0523c3 Mon Sep 17 00:00:00 2001 From: "Jason R. Jones" Date: Fri, 24 Jul 2020 22:01:56 -0400 Subject: [PATCH] Separated into `cli()` and `main()` to enable build script to call `main()` --- src/wireviz/wireviz.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/wireviz/wireviz.py b/src/wireviz/wireviz.py index fe51cc7..d589a8b 100755 --- a/src/wireviz/wireviz.py +++ b/src/wireviz/wireviz.py @@ -203,7 +203,7 @@ def parse(yaml_input: str, return_types: (None, str, Tuple[str]) = None) -> Any: @click.argument('input_file', required=True) @click.option('--prepend', '-p', default=None, help='a YAML file containing a library of templates and parts that may be referenced in the `input_file`') @click.option('--out', '-o', multiple=True, default=['png'], help='specify one or more output types to be generated; currently supports "png" "svg", "html", "csv", "csv_excel", "csv_unix", "tsv", "tsv_excel"') -def main(input_file, prepend, out): +def cli(input_file, prepend, out): """ Take a YAML file containing a harness specification and, utilizing GraphViz, translate that specification into various output formats. @@ -212,8 +212,12 @@ def main(input_file, prepend, out): $>wireviz my_input_file.yml -o png -o svg """ + main(input_file, prepend, out) + + +def main(input_file, prepend, out): if not os.path.exists(input_file): - print(f'Error: input file {input_file} inaccessible or does not exist, check path') + print(f'Error: input file "{input_file}" inaccessible or does not exist, check path') sys.exit(1) with open_file_read(input_file) as fh: @@ -250,4 +254,4 @@ def main(input_file, prepend, out): if __name__ == '__main__': - main() + cli()