Skip to content

Commit

Permalink
Simplify main()
Browse files Browse the repository at this point in the history
  • Loading branch information
formatc1702 committed Oct 7, 2021
1 parent 938d76c commit bb30f5e
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/wireviz/wireviz.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,11 +236,13 @@ def main():

args = parse_cmdline()

if not Path(args.input_file).exists():
print(f'Error: input file {args.input_file} inaccessible or does not exist, check path')
file_in = Path(args.input_file)

if not file_in.exists():
print(f'Error: input file {file_in} inaccessible or does not exist, check path')
sys.exit(1)

with open_file_read(args.input_file) as fh:
with open_file_read(file_in) as fh:
yaml_input = fh.read()

if args.prepend_file:
Expand All @@ -252,8 +254,7 @@ def main():
yaml_input = prepend + yaml_input

if not args.output_file:
file_out = Path(args.input_file)
file_out = file_out.parent / file_out.stem # extension will be added by graphviz output function
file_out = file_in.parent / file_in.stem # extension will be added by graphviz output function
else:
file_out = Path(args.output_file)
file_out = file_out.resolve()
Expand Down

0 comments on commit bb30f5e

Please sign in to comment.