aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2020-05-04 17:10:02 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2020-05-04 17:10:02 +0200
commitf1957839c0c8c8cbce1dccd9c419ae6d5c6e358c (patch)
treea16f0bb896b5774f4a7e41469222592408a0d4ed
parentAdd some more text formatting tags. (diff)
downloadcalp-f1957839c0c8c8cbce1dccd9c419ae6d5c6e358c.tar.gz
calp-f1957839c0c8c8cbce1dccd9c419ae6d5c6e358c.tar.xz
Add --help to main!
-rwxr-xr-xmodule/main.scm56
1 files changed, 52 insertions, 4 deletions
diff --git a/module/main.scm b/module/main.scm
index cd5f547e..baa80ad8 100755
--- a/module/main.scm
+++ b/module/main.scm
@@ -15,6 +15,7 @@
(util time)
(util app)
(util config)
+ (util options)
((util hooks) :select (shutdown-hook))
((entry-points html) :prefix html-)
@@ -36,9 +37,49 @@
(define options
- '((statprof (value optional))
- (repl (value optional))
- (help (single-char #\h))))
+ '((statprof (value display-style)
+ (description (*TOP* "Run the program within Guile's built in statical"
+ "profiler. Display style is one of "
+ (b "flat") " and " (b "tree") ".")))
+ (repl (value address)
+ (description
+ (*TOP* "Start a Guile repl which can be connected to, defaults to the unix socket "
+ (i "/run/user/${UID}/calp-${PID}") ", but it can be bound to any unix or "
+ "TCP socket. ((@ (util app) current-app)) should return the current app context."
+ (br)
+ (b "Should NOT be used in production.")))
+ )
+ (help (single-char #\h)
+ (description "Print this help"))))
+
+(define module-help
+ '(*TOP* (br)
+ (center (b "Calp")) (br) (br)
+ "Usage: " (b "calp") " [ " (i flags) " ] " (i mode) " [ " (i "mode flags") " ]" (br)
+ (p (b "html") " reads calendar files from disk, and writes them to static HTML files.")
+
+ (p (b "terminal") " loads the calendars, and startrs an interactive terminal interface.")
+
+ "[UNTESTED]" (br)
+ (p (b "import") "s an calendar object into the database.")
+
+ (p (b "text") " formats and justifies what it's given on standard input, "
+ "and writes it to standard output. Similar to this text.")
+
+ (p (b "info") " does something?")
+
+ (p (b "ical") " loads the calendar database, and imideately "
+ "reserializes it back into ICAL format. "
+ "Useful for merging calendars.")
+
+ (p (b "benchmark") " does something else?")
+
+ (p (b "server") " starts an HTTP server which dynamicly loads and displays event. The "
+ (i "/month/{date}.html") " & " (i "/week/{date}.html") " runs the same output code as "
+ (b "html") ". While the " (i "/calendar/{uid}.ics") " uses the same code as " (b "ical") ".")
+
+ (hr) (br)
+ (center (b "Flags")) (br)))
(define (ornull a b)
(if (null? a)
@@ -46,10 +87,17 @@
(define (wrapped-main args)
- (define opts (getopt-long args options #:stop-at-first-non-option #t))
+ (define opts (getopt-long args (getopt-opt options) #:stop-at-first-non-option #t))
(define stprof (option-ref opts 'statprof #f))
(define repl (option-ref opts 'repl #f))
+ (awhen (option-ref opts 'help #f)
+ (display (sxml->ansi-text module-help)
+ (current-output-port))
+ (print-arg-help options)
+ (throw 'return)
+ )
+
(when stprof (statprof-start))
(cond [(eqv? #t repl) (repl-start (format #f "~a/calp-~a" (runtime-dir) (getpid)))]