From 904de577261e7024373e7a42fd763184764238f9 Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Tue, 10 Oct 2023 13:15:59 -0400 Subject: Don't swallow namespace-parsing errors Previously, if there was a problem with the inputs and bild failed to determine the namespace, 'fromPath' would return 'Nothing' and then 'catMaybes' would drop the error-causing input altogether. In the one time that I had a bad input, this made debugging incredibly difficult. It's always a bad idea to swallow errors silently, so instead lets just kill the program if we have bad inputs. --- Biz/Ide/ns.bash | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100755 Biz/Ide/ns.bash (limited to 'Biz/Ide/ns.bash') diff --git a/Biz/Ide/ns.bash b/Biz/Ide/ns.bash new file mode 100755 index 0000000..e988bfe --- /dev/null +++ b/Biz/Ide/ns.bash @@ -0,0 +1,26 @@ +#!/usr/bin/env bash +set -euo pipefail +fd --exclude=_ -t f . ${CODEROOT:?} | sed "s,${CODEROOT:?}/*,,g" \ + | fzf \ + --bind "alt-space:execute(bild {} && read -p [fin])" \ + --bind "alt-enter:execute(vim {})" \ + --bind "alt-l:execute(lint {} && read -p [fin])" \ + --bind "enter:execute(repl {})" \ + --bind "ctrl-space:execute(ship {} && read -p [fin])" \ + --bind "alt-t:execute(bild {} && run {} test && read -p [fin])" \ + --bind "ctrl-/:change-preview-window(90%|hidden|)" \ + --bind "alt-0:change-preview(bat -p --color=always {})" \ + --bind "alt-1:change-preview(git log --color=always --date=relative --abbrev-commit --pretty=format:'%Cred%h%Creset %s / %an %Creset%C(yellow)%d%Creset%Cgreen(%cr)%Creset' -- {})" \ + --bind "alt-2:change-preview(git log --color=always {})" \ + --bind "alt-3:change-preview(git log --color=always -p {})" \ + --bind "alt-4:change-preview(git blame -c --date=short {})" \ + --bind "alt-5:change-preview(git log --pretty=short {} | git shortlog -nse)" \ + --bind "alt-6:change-preview(git log --pretty=short {} | git shortlog)" \ + --bind "backward-eof:abort" \ + --bind "pgup:preview-page-up" \ + --bind "pgdn:preview-page-down" \ + --header="repl: enter | edit: alt-enter | bild: alt-space | test: alt-t | lint: alt-l | ship: ctrl-space" \ + --header-first \ + --preview-window="border-sharp,88" \ + --preview "bat -p --color=always {}" +### -- cgit v1.2.3