commit 46d7e5f3f9eae8de640d2401c4e61a47b112a4f0
parent 8440af67b2c025920bdc6d7effa0da89122613b7
Author: William Casarin <jb55@jb55.com>
Date: Fri, 7 May 2021 08:50:38 -0700
build-preview
Signed-off-by: William Casarin <jb55@jb55.com>
Diffstat:
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/bin/build-preview b/bin/build-preview
@@ -0,0 +1,10 @@
+#!/usr/bin/env bash
+
+process_line() {
+ <<<"$1" stripansi | sed 's,\[,\\[,g;s,\],\\],g'
+}
+
+line="$(process_line "$1")"
+
+
+<.build-result stripansi | grep -E -A20 "$line" | bat -l rust --color=always --highlight-line 1
diff --git a/bin/fuzz-compile-error b/bin/fuzz-compile-error
@@ -8,8 +8,8 @@ if [ ! -f .build-result ]; then
fi
# todo: determine project language
-LANG=rust
-ERR_OPTS="--exit-0 --tac --preview 'grep -B1 -A20 {} .build-result | bat -l $LANG --color=always --highlight-line 1' --preview-window=:wrap:60%"
+PLANG=rust
+ERR_OPTS="--exit-0 --tac --ansi --preview 'build-preview {}' --preview-window=top"
<.build-result grep -E '[[:space:]]*[^: ]+:[0-9]+.*' |
env FZF_DEFAULT_OPTS="$FZF_DEFAULT_OPTS $ERR_OPTS" fuzzer "$@" |