From 358e68c8dbd50c1459d45ca5406094b2d14d44ce Mon Sep 17 00:00:00 2001 From: Artemis Tosini Date: Fri, 1 Dec 2023 00:31:40 +0000 Subject: [PATCH] format.py: add watch option --- format.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/format.py b/format.py index 9fcda05..639b66f 100755 --- a/format.py +++ b/format.py @@ -171,6 +171,8 @@ parser.add_argument( "-d", "--dont-compile", action="store_true", help="Don't compile to output.pdf" ) +parser.add_argument("-w", "--watch", action="store_true", help="Watch input files") + args = parser.parse_args() cldr_root = ET.parse( @@ -239,4 +241,14 @@ with open("options.json", "w") as options: if args.dont_compile: exit() -os.execlp("typst", "typst", "compile", "--font-path", "content", "--font-path", os.getenv("TYPST_FONT_PATHS"), args.template, "output.pdf") +os.execlp( + "typst", + "typst", + "watch" if args.watch else "compile", + "--font-path", + "content", + "--font-path", + os.getenv("TYPST_FONT_PATHS"), + args.template, + "output.pdf", +)