Skip to content

Commit 6f84e5e

Browse files
committed
Distinguish apply import vars script output
Add a little ANSI color to apply import vars output to draw my tired old eyes to what is important.
1 parent e14d166 commit 6f84e5e

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

deps.edn

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@
6363
:extra-deps {org.clojure/tools.namespace {:mvn/version "1.1.0"}
6464
cli-matic/cli-matic {:mvn/version "0.4.3"}}}
6565

66-
:apply-import-vars {:extra-deps {metosin/malli {:mvn/version "0.3.0"}}
66+
:apply-import-vars {:extra-deps {metosin/malli {:mvn/version "0.3.0"}
67+
io.aviso/pretty {:mvn/version "0.1.36"}}
6768
:ns-default lread.apply-import-vars}
6869

6970
;;

script/lread/apply_import_vars.clj

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
(ns lread.apply-import-vars
44
(:require [clojure.java.io :as io]
55
[clojure.string :as string]
6+
[io.aviso.ansi :as ansi]
67
[malli.core :as m]
8+
79
[malli.error :as me]
810
[malli.util :as mu]
911
;; use internal nses instead of exported nses, we are generating exported nses.
@@ -208,7 +210,9 @@
208210
stale-cnt (->> (process-templates)
209211
(reduce (fn [stale-cnt {:keys [template-filename target-filename changed?]}]
210212
(println "Template:" template-filename)
211-
(println (if changed? "X" " ") "Target:" target-filename (if changed? "STALE" "(no changes)"))
213+
(println (if changed? "X" " ") "Target:" target-filename (if changed?
214+
(-> "STALE" ansi/bold-red-bg ansi/black)
215+
"(no changes)"))
212216
(if changed? (inc stale-cnt) stale-cnt))
213217
0))]
214218
(println (format "\n%d of %d targets are stale." stale-cnt (count templates)))
@@ -219,7 +223,11 @@
219223
update-cnt (->> templates
220224
(reduce (fn [update-cnt {:keys [template-filename target-filename changed? target-clj]}]
221225
(println "Template:" template-filename)
222-
(println " Target:" target-filename (if changed? "UPDATE" "(no changes detected)"))
226+
(println " Target:" target-filename (if changed?
227+
(-> "UPDATE"
228+
ansi/bold-green-bg
229+
ansi/black)
230+
"(no changes detected)"))
223231
(if changed?
224232
(do
225233
(spit target-filename target-clj)

0 commit comments

Comments
 (0)