From 723b769fcd60f00e865c89e3b38d60fe4264ec79 Mon Sep 17 00:00:00 2001 From: Zakarya Date: Tue, 30 Jul 2024 14:28:24 -0700 Subject: [PATCH] Add -r option to make --- make | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/make b/make index fc029b1..f7d995f 100755 --- a/make +++ b/make @@ -1,6 +1,6 @@ #!/bin/python3 -import os, sys +import os, sys, shutil def get_file_tree(directory): @@ -54,7 +54,8 @@ Use "make [svg|png|webp]" to compile all graphics in a specific format Flags: -h or --help - Show this message -s [graphic name] [svg|png|webp] - Compile a specific graphic - -o [output file] - compile to a specific file (only works after -s) + -o [output file] - Compile to a specific file (only works after -s) + -r - Remove the output directory before compiling Examples: - make all @@ -68,7 +69,12 @@ if len(sys.argv) != 1: if sys.argv[1] == "-h" or sys.argv[1] == "--help": print_help() - elif sys.argv[1] == "all": + if sys.argv[1] == "-r": + sys.argv.pop(1) + print("Removing output directory...") + shutil.rmtree("output") # Scary + + if sys.argv[1] == "all": if len(sys.argv) == 3: if sys.argv[2] == "svg": print("Compiling all SVGs")