mirror of
https://github.com/pmret/papermario.git
synced 2024-11-18 17:02:46 +01:00
29c3ffa2e0
* clean * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "901241040d" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "901241040d" git-subrepo: version: "0.4.5" origin: "https://github.com/ingydotnet/git-subrepo" commit: "aa416e4" * splat update * more matches after nop hack * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "715ee0ad55" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "715ee0ad55" git-subrepo: version: "0.4.5" origin: "https://github.com/ingydotnet/git-subrepo" commit: "aa416e4" * Renames, match boot_idle * one mo * wips * fish func Co-authored-by: @JaThePlayer * sushie dun * warnings * clean * match a nok func * nok_02 stuff * nok_04 party image * func_802BD5D8_3174F8 * LoadPartyImage & stuff * warnings
46 lines
936 B
Python
46 lines
936 B
Python
import sys
|
|
from typing import Optional
|
|
|
|
from colorama import Fore, init, Style
|
|
|
|
init(autoreset=True)
|
|
|
|
newline = True
|
|
|
|
Status = Optional[str]
|
|
|
|
|
|
def write(*args, status=None, **kwargs):
|
|
global newline
|
|
|
|
if not newline:
|
|
print("")
|
|
newline = True
|
|
|
|
print(status_to_ansi(status) + str(args[0]), *args[1:], **kwargs)
|
|
|
|
|
|
def error(*args, **kwargs):
|
|
write(*args, **kwargs, status="error")
|
|
sys.exit(2)
|
|
|
|
|
|
# The line_num is expected to be zero-indexed
|
|
def parsing_error_preamble(path, line_num, line):
|
|
write("")
|
|
write(f"error reading {path}, line {line_num + 1}:", status="error")
|
|
write(f"\t{line}")
|
|
|
|
|
|
def status_to_ansi(status: Status):
|
|
if status == "ok":
|
|
return Fore.GREEN
|
|
elif status == "warn":
|
|
return Fore.YELLOW + Style.BRIGHT
|
|
elif status == "error":
|
|
return Fore.RED + Style.BRIGHT
|
|
elif status == "skip":
|
|
return Style.DIM
|
|
else:
|
|
return ""
|