                         "id" (get arguments 1)
                         "due-date" (unparse-date (t/plus (parse-date (:issue-date options))
                                                          (t/days (:net options)))))))
-
-(defn cwd []
-  (System/getProperty "user.dir"))
-
-(defn get-invoice-filenames []
-  (filter #(.endsWith % ".json") (map #(.getName %) (file-seq (io/file (cwd))))))
-
-(defn read-all-invoices []
-  (map read-json (get-invoice-filenames)))
-
-(defn options-to-filter [options]
-  (fn [invoice]
-    (every? #(= (get options %) (get invoice (name %))) (keys options))))
-
-(defn pretty-print-invoice [invoice]
-  (format (->> ["\nInvoice #%s"
-                "Client: %s"
-                "Issue date: %s"
-                "Due date: %s (Net %d)"
-                "Amount: %d %s"]
-               (string/join \newline))
-          (get invoice "id")
-          (get invoice "client")
-          (get invoice "issue-date")
-          (get invoice "due-date")
-          (get invoice "net")
-          (get invoice "amount")
-          (get invoice "currency")))
 
 (defn data [options]
   (println (json/write-str (filter (options-to-filter options) (read-all-invoices)))))

(defn parse-date [date-string]
  (f/parse date-formatter date-string))

(def cli-options
  ;; TODO: add clever currency default
  [["-c" "--currency CURRENCY" "Invoice currency"]
   ["-r" "--client CLIENT" "Client"]
   ["-f" "--filename FILENAME" "Attached file"]
   ["-i" "--issue-date ISSUE_DATE" "Issue date"
    :default (unparse-date (t/now))]
   ["-p" "--paid-on" "Paid on"
    :default (unparse-date (t/now))]
   ["-n" "--net NET" "Net"
    :parse-fn #(Integer/parseInt %)]
   ["-a" "--amount AMOUNT" "Total amount"
    :parse-fn #(Integer/parseInt %)]])

(defn usage [options-summary]
  (->> ["invadm - an invoice manager"

            [clj-time.format :as f]
            [clojure.string :as string])
  (:gen-class))

(defn cwd []
  (System/getProperty "user.dir"))

(def date-formatter
  (f/formatter "yyyy-MM-dd"))
