This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-08-26
Channels
- # announcements (6)
- # beginners (88)
- # calva (12)
- # cider (13)
- # cljs-dev (27)
- # cljsrn (2)
- # clojure (68)
- # clojure-argentina (2)
- # clojure-dev (10)
- # clojure-europe (1)
- # clojure-greece (1)
- # clojure-italy (5)
- # clojure-nl (15)
- # clojure-spec (33)
- # clojure-switzerland (1)
- # clojure-uk (10)
- # clojurescript (121)
- # clojutre (3)
- # code-reviews (2)
- # core-async (1)
- # cursive (10)
- # data-science (1)
- # datomic (21)
- # emacs (10)
- # events (1)
- # fulcro (25)
- # graphql (6)
- # joker (4)
- # kaocha (12)
- # lambdaisland (3)
- # music (2)
- # off-topic (112)
- # om (2)
- # re-frame (25)
- # reagent (29)
- # reitit (93)
- # rewrite-clj (2)
- # shadow-cljs (18)
- # slack-help (4)
- # spacemacs (8)
- # tools-deps (1)
- # vim (2)
- # yada (5)
@jvtrigueros that's not currently implemented, but is straightforward with a plugin.
(ns jvtrigueros.kaocha-plugins
(:require [clojure.string :as str]))
(defn- accumulate [m k v]
(update m k (fnil conj []) v))
(defn- parse-binding [s]
(let [[k & vs] (str/split s #"=")
v (str/join "=" vs)]
[k v]))
(def cli-opts
[nil "--binding" "Configure a dynamic binding, syntax dynamic.var/name=edn-value".
:parse-fn parse-binding
:assoc-fn accumulate])
(defplugin jvtrigueros.kaocha-plugins/cli-bindings
(cli-options [opts]
(conj opts cli-opts))
(config [config]
(let [bindings (get-in config [:kaocha/cli-options :binding])]
(update config :kaocha/bindings #(into (or % {}) bindings)))))
put that under src/
and try it out with kaocha --plugin jvtrigueros.kaocha-plugins/cli-bindings --binding my.var=[1,2,3] --print-config
Sweet! Thanks!
Lemme give it a shot. Essentially I want to toggle some var when testing locally vs ci
ok, in that case I would also look at the features that aero gives you. e.g. create a tests-ci.edn
, containing #merge #include "tests.edn" {:kaocha/bindings {...}}
actually this makes me think we could do some cool stuff with aero's profiles, having a --profile
cli flag, and defaulting to a profile of :ci
when CI=true
(which travis/circle/... all set)
Ah I didn’t know I could do this. Thanks!