diff --git a/clj/src/cljd/build.clj b/clj/src/cljd/build.clj index 80834cc2..3e51aaad 100644 --- a/clj/src/cljd/build.clj +++ b/clj/src/cljd/build.clj @@ -308,6 +308,15 @@ (throw (Exception. (str "Unknown command: " command))))) (list* options args))))) +(defn print-missing-config-warning [f-exists cmd] + (when-not (or f-exists + (contains? #{:help "init"} cmd)) + (newline) + (println (title "WARNING: No cljd.edn file")) + (println "Did you forget to run the following command?") + (println (bright "clj -M -m cljd.build init ")) + (newline))) + (defn print-help [{:keys [doc options] :as spec}] (when doc (newline) @@ -345,7 +354,8 @@ (defn -main [& args] (let [f (java.io.File. (System/getProperty "user.dir") "cljd.edn") - config (if (.exists f) + f-exists (.exists f) + config (if f-exists (with-open [rdr (-> f io/reader java.io.PushbackReader.)] (edn/read rdr)) {})] @@ -354,6 +364,7 @@ compiler/*lib-path* (str (.getPath (java.io.File. (System/getProperty "user.dir") "lib")) "/")] (let [[options cmd cmd-opts & args] (parse-args commands args)] + (print-missing-config-warning f-exists cmd) (case cmd :help (print-help commands) "init"