summaryrefslogtreecommitdiff
path: root/Biz/Ide/hoog.bash
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2023-10-10 13:15:59 -0400
committerBen Sima <ben@bsima.me>2023-10-10 13:15:59 -0400
commit904de577261e7024373e7a42fd763184764238f9 (patch)
tree563e4968eab568466ae3e7a1c747dd24a77986c0 /Biz/Ide/hoog.bash
parent6107f8178e26ada67e5d5ec60501e24528b3db56 (diff)
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.
Diffstat (limited to 'Biz/Ide/hoog.bash')
-rwxr-xr-xBiz/Ide/hoog.bash17
1 files changed, 17 insertions, 0 deletions
diff --git a/Biz/Ide/hoog.bash b/Biz/Ide/hoog.bash
new file mode 100755
index 0000000..976f0d4
--- /dev/null
+++ b/Biz/Ide/hoog.bash
@@ -0,0 +1,17 @@
+#!/usr/bin/env bash
+#
+# search hoogle with fzf
+#
+ set -euo pipefail
+ HOOG="hoogle search --count=200"
+ export FZF_DEFAULT_COMMAND="$HOOG $*"
+ result=$(fzf-tmux \
+ --preview-window=down \
+ --preview "hoogle search --link --info {+2}" \
+ --bind "change:reload:$HOOG {q} || true" \
+ --ansi \
+ | cut -d' ' -f 1,2 \
+ | sed -e 's/ /./g'
+ )
+ hoogle search --info "$result"
+##