From 85cbe1d1285964f2ef5b6c882180a2fd851355ab Mon Sep 17 00:00:00 2001 From: Johannes Schauer Marin Rodrigues Date: Sun, 16 Oct 2022 14:14:40 +0200 Subject: [PATCH] factor out argparse.ArgumentParser to allow for generating completions via shtab --- src/img2pdf.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/img2pdf.py b/src/img2pdf.py index cc30e7c..6c58ea5 100755 --- a/src/img2pdf.py +++ b/src/img2pdf.py @@ -3766,7 +3766,7 @@ def gui(): app.mainloop() -def main(argv=sys.argv): +def get_main_parser(): rendered_papersizes = "" for k, v in sorted(papersizes.items()): rendered_papersizes += " %-8s %s\n" % (papernames[k], v) @@ -4329,8 +4329,11 @@ and left/right, respectively. It is not possible to specify asymmetric borders. action="store_true", help="Instruct the PDF viewer to open the PDF in fullscreen mode", ) + return parser - args = parser.parse_args(argv[1:]) + +def main(argv=sys.argv): + args = get_main_parser().parse_args(argv[1:]) if args.verbose: logging.basicConfig(level=logging.DEBUG)