1
0
Fork 0
mirror of https://github.com/suchmememanyskill/TegraExplorer.git synced 2024-11-22 20:06:43 +00:00

compatibility tm

This commit is contained in:
bleck9999 2021-07-27 12:40:37 +01:00
parent e9fb276e46
commit fd7ebd1cef
No known key found for this signature in database
GPG key ID: D0CA0C41DB616843

View file

@ -1,6 +1,6 @@
# Copyright (c) 2021 bleck9999 # Copyright (c) 2021 bleck9999
# https://github.com/bleck9999/ts-minifier # https://github.com/bleck9999/ts-minifier
# Version: 92743efc # Version: fc30eb39
import argparse import argparse
import re 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", '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_", 'clear': "_x", 'timer': "_t", 'deldir': "_g", 'fsexists': "_f", 'delfile': "_z", "copydir": "c_",
"movefile": "_v", "payload": "_j", "readfile": "_o", "writefile": "w_"} "movefile": "_v", "payload": "_j", "readfile": "_o", "writefile": "w_"}
replace_functions = True replace_functions = False
def wantsumspace(s: str): 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("source", type=str, nargs='+', help="source files to minify")
parser.add_argument("-d", type=str, nargs='?', help="destination folder for minified scripts" parser.add_argument("-d", type=str, nargs='?', help="destination folder for minified scripts"
"\ndefault: ./", default='./') "\ndefault: ./", default='./')
parser.add_argument("--replace-functions", action=argparse.BooleanOptionalAction, parser.add_argument("--replace-functions", action="store_true", default=False,
help="if false, warn if functions are reused instead of replacing them\ndefault: true") help="automatically replace reused functions instead of just warning\ndefault: false")
args = parser.parse_args() args = parser.parse_args()
files = args.source files = args.source
dest = args.d[:-1] if args.d[-1] == '/' else args.d 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: for file in files:
print(f"Minifying {file}") print(f"Minifying {file}")
@ -178,4 +178,3 @@ if __name__ == '__main__':
file = file.split(sep='.')[0].split(sep='/')[-1] file = file.split(sep='.')[0].split(sep='/')[-1]
f = open(f"{dest}/{file}_min.te", 'w') f = open(f"{dest}/{file}_min.te", 'w')
f.write(r) f.write(r)