 ;
-;  (C) Copyright 2016  Pavel Tisnovsky
+;  (C) Copyright 2016, 2017  Pavel Tisnovsky
 ;
 ;  All rights reserved. This program and the accompanying materials
 ;  are made available under the terms of the Eclipse Public License v1.0

(ns clj-mrazik.core
  (:gen-class))

(require '[clojure.pprint :as pprint])
(require '[clj-calendar.calendar :as calendar])

(require '[irclj.core :as irc])

(require '[clojure.tools.cli   :as cli])

(require '[clj-mrazik.config   :as config])
(require '[clj-mrazik.schedule :as schedule])
(require '[clj-mrazik.irc-bot  :as irc-bot])
(require '[clj-mrazik.dyncfg   :as dyncfg])
(require '[clj-mrazik.importer :as importer])

(def cli-options
    "Definitions of all command line options that are  currenty supported."

    (println "Usage:")
    (println summary))

(defn run-app
    [summary show-help? import?]
    (cond show-help? (show-help summary)
          import?    (importer/import-data import?)
          :else      (start-bot)))

(defn -main
    "Entry point to this bot."
    [& args]
    (log/info "Starting the application")
    (let [all-options (cli/parse-opts args cli-options)
          options     (all-options :options)
          show-help?  (options :help)
          import?     (options :import)
          summary     (:summary all-options)]
          (run-app summary show-help? import?))
    (log/info "Exiting from the main function"))

