diff options
| -rw-r--r-- | config.edn | 3 | ||||
| -rw-r--r-- | main.clj | 20 |
2 files changed, 23 insertions, 0 deletions
diff --git a/config.edn b/config.edn new file mode 100644 index 0000000..1e3318a --- /dev/null +++ b/config.edn @@ -0,0 +1,3 @@ +{:editor-command "nvim" + :editor-config "/Users/eltrac/.config/nvim/" + :default-branch "master"} diff --git a/main.clj b/main.clj new file mode 100644 index 0000000..cf2c965 --- /dev/null +++ b/main.clj @@ -0,0 +1,20 @@ +#!/usr/bin/env bb + +(require '[babashka.tasks :refer [shell]] + '[clojure.edn :as edn]) + +(def vimulti-config "config.edn") +(def nvim-config-path "/Users/eltrac/.config/nvim/") + +(let [[branch-name & args] *command-line-args* + config (-> vimulti-config slurp edn/read-string) + current-branch (or + (shell {:dir nvim-config-path + :out :string} + "git branch --show-current") + (:default-branch config))] + (shell {:dir (:editor-config config)} + (str "git switch " branch-name)) + (shell (str (:editor-command config) " " (apply str args))) + (shell {:dir (:editor-config config)} + (str "git switch " current-branch))) |
