factor out bina install

Fri, 05 May 2023 13:12:54 -0500

author
Meredith Howard <mhoward@roomag.org>
date
Fri, 05 May 2023 13:12:54 -0500
changeset 1110
e4edb1419e3f
parent 1109
71d10acde172
child 1111
7f6a94dd56ee

factor out bina install

.lib/sh/stubexec.sh file | annotate | diff | comparison | revisions
.lib/stubs/fzf file | annotate | diff | comparison | revisions
.lib/stubs/gum file | annotate | diff | comparison | revisions
.lib/stubs/just file | annotate | diff | comparison | revisions
--- a/.lib/sh/stubexec.sh
+++ b/.lib/sh/stubexec.sh
@@ -43,4 +43,12 @@ stubexec() {
   stubexec "$@"
 }
 
+bina_install() {
+  local github_repo="$1"
+  mkdir -p ~/.local/bin
+  cd ~/.local/bin
+  curl -fsSL "https://bina.egoist.dev/${github_repo}?dir=." | sh
+  cd -
+}
+
 stubexec "$@"
--- a/.lib/stubs/fzf
+++ b/.lib/stubs/fzf
@@ -2,10 +2,7 @@
 set -eu
 
 install_it() {
-  mkdir -p ~/.local/bin
-  cd ~/.local/bin
-  curl -fsSL 'https://bina.egoist.dev/junegunn/fzf?dir=.' | sh
-  cd -
+  bina_install "junegunn/fzf"
 }
 
 . ~/.lib/sh/stubexec.sh
--- a/.lib/stubs/gum
+++ b/.lib/stubs/gum
@@ -4,10 +4,7 @@ set -eu
 age_limit=7
 
 install_it() {
-  mkdir -p ~/.local/bin
-  cd ~/.local/bin
-  curl -fsSL 'https://bina.egoist.dev/charmbracelet/gum?dir=.' | sh
-  cd -
+  bina_install "charmbracelet/gum"
   # go install github.com/charmbracelet/gum@latest
   # asdf reshim || :
 }
--- a/.lib/stubs/just
+++ b/.lib/stubs/just
@@ -2,10 +2,7 @@
 set -eu
 
 install_it() {
-  mkdir -p ~/.local/bin
-  cd ~/.local/bin
-  curl -fsSL 'https://bina.egoist.dev/casey/just?dir=.' | sh
-  cd -
+  bina_install "casey/just"
   # cargo install just
 }
 

mercurial