summaryrefslogtreecommitdiff
path: root/Biz
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2022-02-09 22:28:10 -0500
committerBen Sima <ben@bsima.me>2022-02-09 22:28:10 -0500
commit11b995a491978ad899e0555ceea7e20f10822766 (patch)
treea44fa245427f92c30d0002eabe9af191b2e38437 /Biz
parent648dc18aa15fb8e25d8d0a0f06e2be8f1a222ac5 (diff)
Add run script and rewrite ns
Diffstat (limited to 'Biz')
-rwxr-xr-xBiz/Ide/ns58
-rwxr-xr-xBiz/Ide/run6
2 files changed, 30 insertions, 34 deletions
diff --git a/Biz/Ide/ns b/Biz/Ide/ns
index c1db77b..cc299c7 100755
--- a/Biz/Ide/ns
+++ b/Biz/Ide/ns
@@ -1,34 +1,24 @@
-#!/usr/bin/env bash
-##
- if [[ $NOUN == "" ]]
- then
- export NOUN=$(fd --exclude=_ -t f . $BIZ_ROOT | fzf-tmux)
- fi
-##
- if [[ $VERB == "" ]]
- then
- export VERB=$(fzf-tmux <<< $(sed 's/ /\n/g' <<< "edit bild push ship lint"))
- fi
-##
- $VERB $NOUN
-##
- printf "\nn:\tchange ns\nv:\tchange verb\nb:\tchange both\n^C:\texit\nelse:\tcontinue\n"
- read -p " ns> " -n 1 input
-##
- if [[ $input == "v" ]]
- then
- unset VERB
- $0
- elif [[ $input == "n" ]]
- then
- unset NOUN
- $0
- elif [[ $input == "b" ]]
- then
- unset NOUN
- unset VERB
- $0
- else
- $0
- fi
-##
+cat \
+ <(echo "ship: ctrl-space") \
+ <(echo "lint: alt-l") \
+ <(echo "test: alt-t") \
+ <(echo "bild: alt-space") \
+ <(echo "edit: alt-enter") \
+ <(echo "repl: enter") \
+ <(fd --exclude=_ -t f . $BIZ_ROOT | sed "s,$BIZ_ROOT/*,,g") \
+ | fzf-tmux \
+ --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(88|hidden|)" \
+ --bind "alt-0:change-preview(cat {})" \
+ --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 "pgup:preview-page-up" \
+ --bind "pgdn:preview-page-down" \
+ --header-lines=6 \
+ --header-first \
+ --preview-window="border-sharp,88" \
+ --preview "cat {}"
diff --git a/Biz/Ide/run b/Biz/Ide/run
new file mode 100755
index 0000000..49cd72d
--- /dev/null
+++ b/Biz/Ide/run
@@ -0,0 +1,6 @@
+#!/usr/bin/env bash
+set -eu
+target=$1
+shift
+out=$(rg --only-matching ": out (\w*)" -r '$1' $target)
+exec "$BIZ_ROOT/_/bin/$out" "$@"