    #_[clojure.pprint :as pp]
    [leiningen.core.eval :as leval]
    [leiningen.clean :as clean]
+   [leiningen.core.main :as main]   
    [clojure.java.io :as io]
    [clojure.set :refer [intersection]]
+   [clojure.pprint :as pp]
    [clj-fuzzy.metrics :as metrics]
    [simple-lein-profile-merge.core :as lm]))
 


  )

;; task
(defn check-config [project]
  (clean-on-dependency-change project)
  (run-config-check
   project
   (fuzzy-select-keys project [:cljsbuild :figwheel])
   {:no-start-option true}))

(defn build-once [project build-ids]
  (run-build-once
   project
   (fuzzy-select-keys project [:cljsbuild :figwheel])
   (source-paths-for-classpath
    (normalize-data project build-ids))
   (vec build-ids)))

(defn figwheel-main [project build-ids]
  (run-figwheel
   project
   (fuzzy-select-keys project [:cljsbuild :figwheel])
   (source-paths-for-classpath
    (normalize-data project build-ids))
   (vec build-ids)))

(defmulti fig-dispatch (fn [project args] (first args)))

(defmethod fig-dispatch :default [project build-ids]
  (figwheel-main project build-ids))

(defmethod fig-dispatch ":check-config" [project args]
  (check-config project))

(defmethod fig-dispatch ":once" [project build-ids]
  (build-once project (rest build-ids)))

(defn figwheel
"Figwheel - a tool that helps you compile and reload ClojureScript.

  To learn more about how to configure Figwheel please see the README
  https://github.com/bhauman/lein-figwheel
"
  [project & command-and-or-build-ids]
  (let [[command & build-ids] command-and-or-build-ids]
    (when-not ((every-pred command-like? report-if-bad-command) command)
      (let [[command build-ids] (if (command-like? command)
                                  [command build-ids]
                                  [nil (and command (cons command build-ids))])]
        (clean-on-dependency-change project)
        (println "Figwheel: Cutting some fruit, just a sec ...")
        (fig-dispatch command project build-ids)))))

#_(figwheel {:cljsbuilds {:builds [{:id :five}
                                 {:id :six}]}}
          )
