Skip to content

Commit 6b1ecae

Browse files
committed
Add --no-prefix / :prefix false flags and option
1 parent ed277cb commit 6b1ecae

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
## Added
44

5+
- Add `--no-prefix` or `{:launchpad/options {:prefix false}}` to hide the
6+
start-of-line per-process prefix in the output
7+
58
## Fixed
69

710
## Changed

src/lambdaisland/launchpad.clj

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@
5252
"--[no-]sayid" {:doc "Include Sayid dependency and middleware"}
5353
"--[no-]debug-repl" {:doc "Include gfredericks/debug-repl dependency and middleware"}
5454
"--[no-]go" {:doc "Call (user/go) on boot"}
55-
"--[no-]namespace-maps" {:doc "Disable *print-namespace-maps* through nREPL middleware"}])
55+
"--[no-]namespace-maps" {:doc "Disable *print-namespace-maps* through nREPL middleware"}
56+
"--[no-]prefix" {:doc "Disable per-process prefix"}])
5657

5758
(def library-versions
5859
(:deps (edn/read-string (slurp (io/resource "launchpad/deps.edn")))))
@@ -497,7 +498,8 @@
497498
(when (pos? size)
498499
(dotimes [i size]
499500
(when @newline?
500-
(.write to (.getBytes prefix))
501+
(when prefix
502+
(.write to (.getBytes prefix)))
501503
(vreset! newline? false))
502504
(let [b (aget buffer i)]
503505
(.write to (int b))
@@ -523,7 +525,10 @@
523525
_ (.putAll (.environment proc-builder) (or env (:env ctx)))
524526
color (mod (hash (or prefix (first cmd))) 8)
525527
prefix (str "[" (ansi-fg (+ 30 color) (or prefix (first cmd))) "] ")
526-
process (pipe-process-output (.start proc-builder) prefix)
528+
process (pipe-process-output
529+
(.start proc-builder)
530+
(when-not (false? (:prefix ctx))
531+
prefix))
527532
_ (swap! processes conj process)
528533
ctx (update ctx :processes (fnil conj []) process)]
529534
(when show-command?

0 commit comments

Comments
 (0)