|
39 | 39 | (set-signal-handler! "TERM" cleanup)
|
40 | 40 |
|
41 | 41 | (def flags
|
42 |
| - ["-v,--verbose" "Print debug information" |
43 |
| - "-p,--nrepl-port PORT" {:doc "Start nrepl on port. Defaults to 0 (= random)" |
44 |
| - :parse-fn #(Integer/parseInt %)} |
45 |
| - "-b,--nrepl-bind ADDR" {:doc "Bind address of nrepl, by default \"127.0.0.1\"." |
46 |
| - :default "127.0.0.1"} |
47 |
| - "--emacs" {:doc "Shorthand for --cider-nrepl --refactor-nrepl --cider-connect" |
48 |
| - :handler (fn [ctx] (assoc ctx |
49 |
| - :cider-nrepl true |
50 |
| - :refactor-nrepl true |
51 |
| - :cider-connect true))} |
52 |
| - "--vs-code" {:doc "Alias for --cider-nrepl" |
53 |
| - :handler (fn [ctx] (assoc ctx :cider-nrepl true))} |
54 |
| - "--cider-nrepl" "Include CIDER nREPL dependency and middleware" |
55 |
| - "--refactor-nrepl" "Include refactor-nrepl dependency and middleware" |
56 |
| - "--cider-connect" "Automatically connect Emacs CIDER" |
57 |
| - "--portal" "Include djblue/portal as a dependency, and define (user/portal)" |
58 |
| - "--sayid" "Include Sayid dependency and middleware" |
59 |
| - "--debug-repl" "Include gfredericks/debug-repl dependency and middleware" |
60 |
| - "--go" "Call (user/go) on boot"]) |
| 42 | + ["-v,--verbose" {:doc "Print debug information" |
| 43 | + :value true} |
| 44 | + "-p,--nrepl-port PORT" {:doc "Start nrepl on port. Defaults to 0 (= random)" |
| 45 | + :parse-fn #(Integer/parseInt %)} |
| 46 | + "-b,--nrepl-bind ADDR" {:doc "Bind address of nrepl, by default \"127.0.0.1\"." |
| 47 | + :default "127.0.0.1"} |
| 48 | + "--[no-]emacs" {:doc "Shorthand for --cider-nrepl --refactor-nrepl --cider-connect" |
| 49 | + :handler (fn [ctx v] |
| 50 | + (assoc ctx |
| 51 | + :cider-nrepl v |
| 52 | + :refactor-nrepl v |
| 53 | + :cider-connect v))} |
| 54 | + "--[no-]vs-code" {:doc "Alias for --cider-nrepl" |
| 55 | + :handler (fn [ctx] (assoc ctx :cider-nrepl true))} |
| 56 | + "--[no-]cider-nrepl" {:doc "Include CIDER nREPL dependency and middleware" |
| 57 | + :value true} |
| 58 | + "--[no-]refactor-nrepl" {:doc "Include refactor-nrepl dependency and middleware" |
| 59 | + :value true} |
| 60 | + "--[no-]cider-connect" {:doc "Automatically connect Emacs CIDER" |
| 61 | + :value true} |
| 62 | + "--[no-]portal" {:doc "Include djblue/portal as a dependency, and define (user/portal)" |
| 63 | + :value true} |
| 64 | + "--[no-]sayid" {:doc "Include Sayid dependency and middleware" |
| 65 | + :value true} |
| 66 | + "--[no-]debug-repl" {:doc "Include gfredericks/debug-repl dependency and middleware" |
| 67 | + :value true} |
| 68 | + "--[no-]go" {:doc "Call (user/go) on boot"} |
| 69 | + "--[no-]namespace-maps" {:doc "Disable *print-namespace-maps* through nREPL middleware" |
| 70 | + :value true}]) |
61 | 71 |
|
62 | 72 | (def library-versions
|
63 | 73 | (:deps (edn/read-string (slurp (io/resource "launchpad/deps.edn")))))
|
|
210 | 220 | (-> (assoc-extra-dep 'com.gfredericks/debug-repl)
|
211 | 221 | ((add-nrepl-middleware 'com.gfredericks.debug-repl/wrap-debug-repl)))
|
212 | 222 |
|
| 223 | + (false? (:namespace-maps ctx)) |
| 224 | + ((add-nrepl-middleware 'lambdaisland.launchpad.middleware/wrap-no-print-namespace-maps)) |
| 225 | + |
213 | 226 | (:portal ctx)
|
214 | 227 | (-> (assoc-extra-dep 'djblue/portal)
|
215 | 228 | (update :eval-forms (fnil conj [])
|
|
544 | 557 | :background? true
|
545 | 558 | :show-command? false}) ctx)))
|
546 | 559 |
|
547 |
| -(def before-steps [read-deps-edn |
548 |
| - handle-cli-args |
| 560 | +(def before-steps [handle-cli-args |
549 | 561 | get-nrepl-port
|
550 | 562 | get-nrepl-bind
|
551 | 563 | ;; inject dependencies and enable behavior
|
|
580 | 592 |
|
581 | 593 | (defn initial-context [ctx]
|
582 | 594 | (let [project-root (:project-root ctx (find-project-root))]
|
583 |
| - (merge |
584 |
| - {:main-opts *command-line-args* |
585 |
| - :executable (or (:executable ctx) |
586 |
| - (str/replace *file* |
587 |
| - (str project-root "/") |
588 |
| - "")) |
589 |
| - :env (into {} (System/getenv)) |
590 |
| - :steps (:default-steps ctx) |
591 |
| - :project-root project-root |
592 |
| - :middleware [] |
593 |
| - :java-args [] |
594 |
| - :eval-forms []} |
595 |
| - ctx))) |
| 595 | + (-> {:main-opts *command-line-args* |
| 596 | + :executable (or (:executable ctx) |
| 597 | + (str/replace *file* |
| 598 | + (str project-root "/") |
| 599 | + "")) |
| 600 | + :env (into {} (System/getenv)) |
| 601 | + :steps (:default-steps ctx) |
| 602 | + :project-root project-root |
| 603 | + :middleware [] |
| 604 | + :java-args [] |
| 605 | + :eval-forms []} |
| 606 | + (merge ctx) |
| 607 | + read-deps-edn))) |
596 | 608 |
|
597 | 609 | (defn process-steps [ctx steps]
|
598 | 610 | (reduce #(%2 %1) ctx steps))
|
|
0 commit comments