File tree Expand file tree Collapse file tree 3 files changed +15
-10
lines changed Expand file tree Collapse file tree 3 files changed +15
-10
lines changed Original file line number Diff line number Diff line change 1
1
# Unreleased
2
2
3
- ## Added
4
-
5
- ## Fixed
6
-
7
3
## Changed
8
4
5
+ - Merge consecutive calls to ` lambdaisland.launchpad.watcher/watch! ` , so it's
6
+ easier to use from user code
7
+ - Don't show full clojure invocation by default, can be seen with ` --verbose `
8
+
9
9
# 0.26.123-alpha (2024-01-29 / d471611)
10
10
11
11
## Fixed
@@ -209,4 +209,4 @@ Initial release
209
209
- lambdaisland.classpath integration
210
210
- Support for cider-nrepl, refactor-nrepl
211
211
- Basic support for shadow-cljs cljs nREPL-base REPL
212
- - Auto-connect for Emacs
212
+ - Auto-connect for Emacs
Original file line number Diff line number Diff line change 494
494
495
495
(defn run-process [{:keys [cmd prefix working-dir
496
496
background? timeout-ms check-exit-code? env
497
- color]
497
+ color show-command? ]
498
498
:or {working-dir " ."
499
- check-exit-code? true }}]
499
+ check-exit-code? true
500
+ show-command? true }}]
500
501
(fn [ctx]
501
502
(let [working-dir (io/file working-dir)
502
503
proc-builder (doto (ProcessBuilder. (map str cmd))
506
507
prefix (str " [" (ansi-fg (+ 30 color) (or prefix (first cmd))) " ] " )
507
508
process (pipe-process-output (.start proc-builder) prefix)
508
509
ctx (update ctx :processes (fnil conj []) process)]
509
- (apply println (str prefix " $" ) (map shellquote cmd))
510
+ (when show-command?
511
+ (apply println (str prefix " $" ) (map shellquote cmd)))
510
512
(if background?
511
513
ctx
512
514
(let [exit (if timeout-ms
523
525
(apply debug (map shellquote args))
524
526
((run-process {:cmd args
525
527
:ctx-process-key :clojure-process
526
- :background? true }) ctx)))
528
+ :background? true
529
+ :show-command? false }) ctx)))
527
530
528
531
(def before-steps [read-deps-edn
529
532
handle-cli-args
Original file line number Diff line number Diff line change 15
15
java.io.File
16
16
io.methvin.watcher.DirectoryWatcher))
17
17
18
+ (defonce handlers (atom nil ))
18
19
(defonce watchers (atom nil ))
19
20
20
21
(defn canonical-path [p]
50
51
" Watch a number of files, takes a map from filename (string) to
51
52
handler (receives a map with `:type` and `:path`, as with Beholder)."
52
53
[file->handler]
53
- (let [file->handler (update-keys file->handler canonical-path)
54
+ (let [file->handler (swap! handlers merge file->handler)
55
+ file->handler (update-keys file->handler canonical-path)
54
56
directories (distinct (map parent-path (keys file->handler)))
55
57
; ; in case of nested directories, only watch the top-most one
56
58
directories (remove (fn [d]
You can’t perform that action at this time.
0 commit comments