Simplify main()
This commit is contained in:
parent
a85ad89719
commit
35e89d4fdf
@ -312,11 +312,13 @@ def main():
|
|||||||
|
|
||||||
args = parse_cmdline()
|
args = parse_cmdline()
|
||||||
|
|
||||||
if not Path(args.input_file).exists():
|
file_in = Path(args.input_file)
|
||||||
print(f'Error: input file {args.input_file} inaccessible or does not exist, check path')
|
|
||||||
|
if not file_in.exists():
|
||||||
|
print(f'Error: input file {file_in} inaccessible or does not exist, check path')
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
with open_file_read(args.input_file) as fh:
|
with open_file_read(file_in) as fh:
|
||||||
yaml_input = fh.read()
|
yaml_input = fh.read()
|
||||||
|
|
||||||
if args.prepend_file:
|
if args.prepend_file:
|
||||||
@ -328,8 +330,7 @@ def main():
|
|||||||
yaml_input = prepend + yaml_input
|
yaml_input = prepend + yaml_input
|
||||||
|
|
||||||
if not args.output_file:
|
if not args.output_file:
|
||||||
file_out = Path(args.input_file)
|
file_out = file_in.parent / file_in.stem # extension will be added by graphviz output function
|
||||||
file_out = file_out.parent / file_out.stem # extension will be added by graphviz output function
|
|
||||||
else:
|
else:
|
||||||
file_out = Path(args.output_file)
|
file_out = Path(args.output_file)
|
||||||
file_out = file_out.resolve()
|
file_out = file_out.resolve()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user