Added CLI parsing template

This commit is contained in:
Felisp 2024-08-13 02:56:20 +02:00
parent d6327a5265
commit ec73dd0c1a
2 changed files with 15 additions and 1 deletions

View file

@ -1,4 +1,4 @@
(defproject rss-thread-watch "0.3.5-SNAPSHOT"
(defproject rss-thread-watch "0.3.7-SNAPSHOT"
:description "RSS based thread watcher"
:url "http://example.com/FIXME"
:license {:name "AGPL-3.0-only"

View file

@ -15,6 +15,7 @@
(ns rss-thread-watch.core
(:require [clojure.java.io :as io]
[clojure.edn :as edn]
[clojure.tools.cli :refer [parse-opts]]
[ring.adapter.jetty :as jetty]
[ring.middleware.params :as rp]
[rss-thread-watch.watcher :as watcher]
@ -22,6 +23,8 @@
[rss-thread-watch.utils :as u])
(:gen-class))
(def VERSION "0.3.7")
;; Internal default config
(def CONFIG-DEFAULT
"Internal default config"
@ -37,8 +40,19 @@
:boards-enabled {"/mlp/" {}
"/g/" {}}})
(def cli-options
"Configuration defining program arguments for cli.tools"
[["-v" "--version" "Print version and license information"]
["-h" "--help" "Prints help"]
["-c" "--config CONFIG_FILE" "Specify config file to use for this run"
:default "./config.edn"
:validate [#(u/file-exists? %) "Specified config file does not exist or is not readable"]]
[nil "--print-default-config" "Prints internal default config file to STDOUT and exits"]])
;; Todo: Think of a way to start repeated download for every catalog efficiently
(defn set-interval
"Calls function every ms"
^{:deprecated true}
[callback ms]
(future (while true (do (try
(callback)