summaryrefslogtreecommitdiff
path: root/vimulti.clj
diff options
context:
space:
mode:
authoreltrac <hi@eltr.ac>2026-07-06 10:56:46 +0800
committereltrac <hi@eltr.ac>2026-07-06 10:56:46 +0800
commit6e7eee1afd93b7f1089119c56f30131d81dd60d9 (patch)
treef7ac22f790850fc7898819e1db584aa749944141 /vimulti.clj
parentb075bfe214bca598863fafe6b6ce3a770aac6e2b (diff)
remove :default-branch setting
Diffstat (limited to 'vimulti.clj')
-rw-r--r--vimulti.clj29
1 files changed, 13 insertions, 16 deletions
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)))