Skip to content

Commit 50cc172

Browse files
committed
Fix handling of compound boolean flags (--emacs, --vs-code)
in combination with options set in deps.(local.)edn.
1 parent babdde6 commit 50cc172

File tree

3 files changed

+21
-34
lines changed

3 files changed

+21
-34
lines changed

CHANGELOG.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Unreleased
22

3-
## Added
4-
53
## Fixed
64

7-
## Changed
5+
- Make sure CLI flags can negate options set in `.clojure/deps.edn` /
6+
`deps.local.edn`, e.g. `{:launchpad/options {:emacs true}}` with
7+
`--no-cider-connect`
88

99
# 0.41.179-alpha (2025-02-28 / d65caab)
1010

deps.edn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
:aliases
99
{:clojure
10-
{:extra-deps {babashka/babashka {:mvn/version "1.12.196" :scope "provided"}
10+
{:extra-deps {babashka/babashka {:mvn/version "1.12.197" :scope "provided"}
1111
org.clojure/tools.deps.alpha {:mvn/version "0.15.1254"}
1212
com.nextjournal/beholder {:mvn/version "1.0.2"}
1313
thheller/shadow-cljs {:mvn/version "2.28.21"}

src/lambdaisland/launchpad.clj

Lines changed: 17 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -43,29 +43,16 @@
4343
:parse-fn #(Integer/parseInt %)}
4444
"-b,--nrepl-bind ADDR" {:doc "Bind address of nrepl, by default \"127.0.0.1\"."
4545
:default "127.0.0.1"}
46-
"--[no-]emacs" {:doc "Shorthand for --cider-nrepl --refactor-nrepl --cider-connect"
47-
:handler (fn [ctx v]
48-
(assoc ctx
49-
:cider-nrepl v
50-
:refactor-nrepl v
51-
:cider-connect v))}
52-
"--[no-]vs-code" {:doc "Alias for --cider-nrepl"
53-
:handler (fn [ctx] (assoc ctx :cider-nrepl true))}
54-
"--[no-]cider-nrepl" {:doc "Include CIDER nREPL dependency and middleware"
55-
:value true}
56-
"--[no-]refactor-nrepl" {:doc "Include refactor-nrepl dependency and middleware"
57-
:value true}
58-
"--[no-]cider-connect" {:doc "Automatically connect Emacs CIDER"
59-
:value true}
60-
"--[no-]portal" {:doc "Include djblue/portal as a dependency, and define (user/portal)"
61-
:value true}
62-
"--[no-]sayid" {:doc "Include Sayid dependency and middleware"
63-
:value true}
64-
"--[no-]debug-repl" {:doc "Include gfredericks/debug-repl dependency and middleware"
65-
:value true}
46+
"--[no-]emacs" {:doc "Shorthand for --cider-nrepl --refactor-nrepl --cider-connect"}
47+
"--[no-]vs-code" {:doc "Alias for --cider-nrepl"}
48+
"--[no-]cider-nrepl" {:doc "Include CIDER nREPL dependency and middleware"}
49+
"--[no-]refactor-nrepl" {:doc "Include refactor-nrepl dependency and middleware"}
50+
"--[no-]cider-connect" {:doc "Automatically connect Emacs CIDER"}
51+
"--[no-]portal" {:doc "Include djblue/portal as a dependency, and define (user/portal)"}
52+
"--[no-]sayid" {:doc "Include Sayid dependency and middleware"}
53+
"--[no-]debug-repl" {:doc "Include gfredericks/debug-repl dependency and middleware"}
6654
"--[no-]go" {:doc "Call (user/go) on boot"}
67-
"--[no-]namespace-maps" {:doc "Disable *print-namespace-maps* through nREPL middleware"
68-
:value true}])
55+
"--[no-]namespace-maps" {:doc "Disable *print-namespace-maps* through nREPL middleware"}])
6956

7057
(def library-versions
7158
(:deps (edn/read-string (slurp (io/resource "launchpad/deps.edn")))))
@@ -288,14 +275,14 @@
288275

289276
(defn handle-cli-args [{:keys [executable project-root deps-edn main-opts] :as ctx}]
290277
(cond
291-
(:emacs ctx)
292-
(assoc (dissoc ctx :emacs)
293-
:cider-nrepl true
294-
:refactor-nrepl true
295-
:cider-connect true)
296-
(:vs-code ctx)
297-
(assoc (dissoc ctx :vs-code)
298-
:cider-nrepl true)
278+
(some? (:emacs ctx))
279+
(merge {:cider-nrepl (:emacs ctx)
280+
:refactor-nrepl (:emacs ctx)
281+
:cider-connect (:emacs ctx)}
282+
(dissoc ctx :emacs))
283+
(some? (:vs-code ctx))
284+
(merge {:cider-nrepl (:emacs ctx)}
285+
(dissoc ctx :vs-code))
299286
:else
300287
ctx))
301288

0 commit comments

Comments
 (0)