Skip to content

Commit

Permalink
update main loops so command line utilities can be debugged from the …
Browse files Browse the repository at this point in the history
…command line
  • Loading branch information
outis committed Nov 11, 2024
1 parent 969e408 commit 8276386
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion pdftocgen/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def main():
print(usage_s, file=sys.stderr)
sys.exit(2)

recipe_file: TextIO = io.TextIOWrapper(sys.stdin.buffer, encoding='utf-8', errors='ignore')
recipe_file: TextIO = None
readable: bool = False
vpos: bool = False
out: TextIO = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8', errors='ignore')
Expand Down Expand Up @@ -129,6 +129,8 @@ def main():
print(usage_s, file=sys.stderr)
sys.exit(1)

if not recipe_file:
recipe_file = io.TextIOWrapper(sys.stdin.buffer, encoding='utf-8', errors='ignore')
path_in: str = args[0]
# done parsing arguments

Expand Down
4 changes: 3 additions & 1 deletion pdftocio/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def main():
print(usage_s, file=sys.stderr)
sys.exit(2)

toc_file: TextIO = io.TextIOWrapper(sys.stdin.buffer, encoding='utf-8', errors='ignore')
toc_file: TextIO = None
print_toc: bool = False
readable: bool = False
out: Optional[str] = None
Expand Down Expand Up @@ -131,6 +131,8 @@ def main():
print(usage_s, file=sys.stderr)
sys.exit(1)

if not toc_file:
toc_file = io.TextIOWrapper(sys.stdin.buffer, encoding='utf-8', errors='ignore')
path_in: str = args[0]
# done parsing arguments

Expand Down

0 comments on commit 8276386

Please sign in to comment.