diff --git a/ts-minifier.py b/ts-minifier.py index 6c8dfcc..a7a5c2f 100644 --- a/ts-minifier.py +++ b/ts-minifier.py @@ -1,6 +1,6 @@ # Copyright (c) 2021 bleck9999 # https://github.com/bleck9999/ts-minifier -# Version: 92743efc +# Version: fc30eb39 import argparse import re @@ -11,7 +11,7 @@ sub_funcs = {'while': "_h", 'print': "_p", 'println': "_l", 'mountsys': "_s", 'm 'mkdir': "_k", 'memory': "_m", 'ncatype': "_n", 'pause': "_w", 'color': "_a", 'menu': "__", 'emu': "_u", 'clear': "_x", 'timer': "_t", 'deldir': "_g", 'fsexists': "_f", 'delfile': "_z", "copydir": "c_", "movefile": "_v", "payload": "_j", "readfile": "_o", "writefile": "w_"} -replace_functions = True +replace_functions = False def wantsumspace(s: str): @@ -163,13 +163,13 @@ if __name__ == '__main__': parser.add_argument("source", type=str, nargs='+', help="source files to minify") parser.add_argument("-d", type=str, nargs='?', help="destination folder for minified scripts" "\ndefault: ./", default='./') - parser.add_argument("--replace-functions", action=argparse.BooleanOptionalAction, - help="if false, warn if functions are reused instead of replacing them\ndefault: true") + parser.add_argument("--replace-functions", action="store_true", default=False, + help="automatically replace reused functions instead of just warning\ndefault: false") args = parser.parse_args() files = args.source dest = args.d[:-1] if args.d[-1] == '/' else args.d - replace_functions = args.replace_functions if args.replace_functions is not None else True + replace_functions = args.replace_functions if args.replace_functions is not None else False for file in files: print(f"Minifying {file}") @@ -178,4 +178,3 @@ if __name__ == '__main__': file = file.split(sep='.')[0].split(sep='/')[-1] f = open(f"{dest}/{file}_min.te", 'w') f.write(r) -