commit 0e3a9f0a45b0eafde6a7170dd7c064f68959f985
parent e2437fafdaa509fab4deeb3ae30a220e12ed7bf8
Author: William Casarin <jb55@jb55.com>
Date: Wed, 18 Nov 2020 12:43:19 -0800
fuzz: search-file
Diffstat:
5 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/bin/fuzz-compile b/bin/fuzz-compile
@@ -2,5 +2,5 @@
set -eou pipefail
-#make_cmd=$(fuzz-make "$@")
-echo make -j \2\>\&\1\| tee .build-result
+make_target=$(fuzz-make "$@")
+echo make -j $make_target \2\>\&\1\| tee .build-result
diff --git a/bin/fuzz-compile-repeat-and-error b/bin/fuzz-compile-repeat-and-error
@@ -0,0 +1,3 @@
+#!/usr/bin/env bash
+eval "$(fuzz-compile-repeat)"
+fuzz-compile-error
diff --git a/bin/fuzz-make b/bin/fuzz-make
@@ -5,4 +5,4 @@ set -eou pipefail
cmd=$(grep '^[^#[:space:]].*:' Makefile | grep -v PHONY | cut -d: -f1 | sort |
env FZF_DEFAULT_OPTS="$FZF_DEFAULT_OPTS --select-1 --exit-0" fuzzer "$@")
-echo make $cmd
+echo $cmd
diff --git a/bin/fuzz-search-file b/bin/fuzz-search-file
@@ -0,0 +1,8 @@
+#!/usr/bin/env bash
+set -eou pipefail
+file=$(rg --files | fuzzer "$@")
+file=$(readlink -f "$file")
+batcmd="bat --color=always \"$file\" | cat -n | $FUZZER --ansi --tac | awk '{print \$1}'"
+fuzz-record-command "$batcmd | xargs -I{} $EDITOR \"$file\" +\{\}"
+line=$(eval $batcmd)
+echo $EDITOR \"$file\" +$line
diff --git a/dotfiles/commands b/dotfiles/commands
@@ -15,6 +15,7 @@ ce compile error fuzz-compile-error
cs compile show build echo cat .build-result
m make fuzz-make
sp search project fuzz-search-files
+ss search project file fuzz-search-file
Sr systemd restart fuzz-systemd-restart
Ss systemd start fuzz-systemd-start
SS systemd stop fuzz-systemd-stop