             [clojure.tools.namespace.repl :as ns.repl]
             [clojure.java.io :as io])
   (:import (java.io File)))
+
+(ns.repl/disable-reload! *ns*)
 
 (defn help []
   (println (str ">>> in ns " *ns*))

     (printf "end |%s| %s - %sms\n" ~tag   (str (java.time.LocalDateTime/now)) time#)
     return#))

(defn start-system!
  "Given a namespace, usually some-service.user, do the following:
  - refresh

  - start  system, invoking somer-service.user/start
  Warning: best if the system is not running, or things will go south"
  [an-ns]
  (if (get @system-status an-ns)
    (println "!!  System possibly running")
    (do
      (println "!! Refreshing and reloading " an-ns)
      (refresh)
      (require an-ns)
      (let [f (ns-resolve an-ns 'start)]
        (f)
        (swap! system-status (fn [s] (assoc s an-ns true)))
        ))))

(defn stop-system!
  "Given a namespace, usually some-service.user, stop the system"
  [an-ns]
  (let [f (ns-resolve an-ns 'stop)]
    (f)
    (swap! system-status (fn [s] (assoc s an-ns false)))))

(init!)
