From 6e7eee1afd93b7f1089119c56f30131d81dd60d9 Mon Sep 17 00:00:00 2001 From: eltrac Date: Mon, 6 Jul 2026 10:56:46 +0800 Subject: remove :default-branch setting --- config.edn | 4 +--- vimulti.clj | 29 +++++++++++++---------------- 2 files changed, 14 insertions(+), 19 deletions(-) diff --git a/config.edn b/config.edn index 1e3318a..b096e69 100644 --- a/config.edn +++ b/config.edn @@ -1,3 +1 @@ -{:editor-command "nvim" - :editor-config "/Users/eltrac/.config/nvim/" - :default-branch "master"} +{:editor-command "nvim"} diff --git a/vimulti.clj b/vimulti.clj index 30c6c25..4775f11 100644 --- a/vimulti.clj +++ b/vimulti.clj @@ -6,8 +6,7 @@ '[clojure.string :as str]) (def default-config - {:editor-command "nvim" - :default-branch "master"}) + {:editor-command "nvim"}) ;; configuration helpers (defn- config-path [] @@ -52,7 +51,7 @@ app-name (if (= (first target-array) "") "nvim" (first target-array)) repo (fs/path (System/getProperty "user.home") ".config" app-name) no-mark (= (count target-array) 1)] - (when (> (count target-array) 2) + (when (> (count target-array) 2) (println "Invalid target string.") (System/exit 1)) (cond-> {:app-name app-name} @@ -63,16 +62,14 @@ ;; main ;; target should be a string like "app-name:branch" or "app-name@tag" (let [[target & args] *command-line-args* - target-map (parse-target-string target)] - (let [current-branch (or - (get-current-branch (:repo target-map)) - (:default-branch config))] - (when-let [switch-to (or (:branch target-map) - (:tag target-map))] - (let [tag? (boolean (:tag target-map))] - (shell {:dir (:repo target-map)} - (str "git switch " switch-to (if tag? "--detach" ""))))) - (shell {:extra-env {"NVIM_APPNAME" (:app-name target-map)}} - (:editor-command config) (apply str args)) - (shell {:dir (:repo target-map)} - (str "git switch " current-branch)))) + target-map (parse-target-string target) + current-branch (get-current-branch (:repo target-map))] + (when-let [switch-to (or (:branch target-map) + (:tag target-map))] + (let [tag? (boolean (:tag target-map))] + (shell {:dir (:repo target-map)} + (str "git switch " switch-to (if tag? "--detach" ""))))) + (shell {:extra-env {"NVIM_APPNAME" (:app-name target-map)}} + (:editor-command config) (apply str args)) + (shell {:dir (:repo target-map)} + (str "git switch " current-branch))) -- cgit v1.2.3