From 11b995a491978ad899e0555ceea7e20f10822766 Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Wed, 9 Feb 2022 22:28:10 -0500 Subject: Add run script and rewrite ns --- Biz/Ide/ns | 58 ++++++++++++++++++++++++---------------------------------- Biz/Ide/run | 6 ++++++ 2 files changed, 30 insertions(+), 34 deletions(-) create mode 100755 Biz/Ide/run (limited to 'Biz') 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" "$@" -- cgit v1.2.3