diff --git a/Makefile b/Makefile index ba3eec747..484442a78 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,14 @@ +# this make file is just a small wrapper/helper to easily use this workspace within vim +# +# 1. Build workspace within vim and retrieve compile errors + warnings +# :make c +# 2. Format the code +# :make f t: c c: - cargo build --workspace --message-format=json | python3 ~/.bin/rerr.py + cargo build --workspace --message-format=json | python3 ./scripts/rerr.py f: cargo fmt diff --git a/scripts/rerr.py b/scripts/rerr.py new file mode 100644 index 000000000..93cfe9616 --- /dev/null +++ b/scripts/rerr.py @@ -0,0 +1,11 @@ +#!/usr/bin/env python3 +import sys +import json + +for line in map(str.rstrip, sys.stdin): + m = json.loads(line) + try: + for s in m["message"]["spans"]: + print("{}:{}: {}".format(s["file_name"], s["line_start"], m["message"]["message"])) + except: + pass