             [taoensso.timbre.appenders.core :as appenders])
   (:gen-class))
 
+
 ;====================================================================================
 ; Main utils
 ;====================================================================================

        ]
       (string/join \newline)))

(defn exit [status msg]
  (println msg)
  (System/exit status))

(defn error-msg [errors]
  (str "The following errors occurred while parsing your command:\n\n"
       (string/join \newline errors)))


;====================================================================================
; Common Usage
;====================================================================================
(def common-options
  [["-C" "--config PATH" "Path to config"
    :default nil]

   ["-e" "--engine BROWSER" "Headless browser: phantom, chrome or firefox"
    :parse-fn keyword
    :validate [(fn [engine] (some #(= engine %) [:phantom :chrome :firefox]))]]

   ;Server Args--------------------------------------------------------------------------------------------
   ["-P" "--port PORT" "Port number for the server."
    :parse-fn #(Integer/parseInt %)
    :validate [#(< 0 % 0x10000) "Must be a number between 0 and 65536"]]




;====================================================================================
; Common usage summary
;====================================================================================
(defn usage [common-summary cmd-summary server-summary]
  (->> [server-name
        ""
        "Usage: java -jar anychart-export.jar action [options]"
        "Actions:"
        "  server    Start a new instance of AnyChart Export Server."
        "            Use --help arg with action for more info."
        ""
        "  cmd       Run Export Server once"
        "            Use --help arg with action for more info."
        ""
        "Common options:"
        common-summary
        ""
        "CMD options:"
        cmd-summary
        ""
        "Server options:"
        server-summary
        ""
        "Please, see http://docs.anychart.com for more info."
        ]
       (string/join \newline)))


;====================================================================================
; Server usage summary
;====================================================================================
(defn server-usage [options-summary]
  (->> [server-name
