Copy global boards-defaults to every board-config

This commit is contained in:
Felisp 2024-07-28 18:26:38 +02:00
parent cd540fda36
commit 6391e115d1

View file

@ -57,19 +57,15 @@
(edn/read (java.io.PushbackReader. r))))))
(defn config-fill-board-defaults
"Fills every enabled board with default values"
[conifg]
;; Získat všechny klíče desek které musíme vyplnit
;; Každý klíč mergnout s default mapou
(u/map-apply-defaults )
(let [board-defaults (:boards-default config)
boards (keys (:boards-enabled config))]
(update-in config '(:boards-enabled) (fn [val]
(u/fmap (fn [])
val) )
;; just do fmap of boards
())
)
"Fills every enabled board with default config values"
[config]
(let [defaults (:boards-defaults config)]
(update-in config
'(:boards-enabled)
(fn [mp]
(u/fmap (fn [k v]
(u/map-apply-defaults v defaults))
mp)))))
(defn get-some-config
"Attempts to get config somehow,
@ -79,13 +75,12 @@
;; args do not include path to executable so first arg
;; should be config file
[cmd-args]
(config-fill-board-defaults
(let [file-to-try (u/nil?-else (first cmd-args)
"./config.edn")]
(u/when-else (load-config file-to-try)
(println "WARN: Using default internal config because suggessted file: '" file-to-try "' not found.")
CONFIG-DEFAULT)))
;;TODO: We want to copy default board-local config into every board, that way we won't have to always look
;; into defaults, but
CONFIG-DEFAULT))))
;; Todo: Add option to write default config to stdout
(defn -main