diff options
author | David Thompson <dthompson2@worcester.edu> | 2015-01-04 20:02:16 -0500 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2015-01-04 20:02:16 -0500 |
commit | 1cd43ba9677a7e5e988a2aaeb944434debaaa58b (patch) | |
tree | e25f63774df74c73f611db3fd7f53ba24283d488 /haunt/ui.scm |
First commit.
Diffstat (limited to 'haunt/ui.scm')
-rw-r--r-- | haunt/ui.scm | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/haunt/ui.scm b/haunt/ui.scm new file mode 100644 index 0000000..b2db00c --- /dev/null +++ b/haunt/ui.scm @@ -0,0 +1,51 @@ +;;; Haunt --- Static site generator for GNU Guile +;;; Copyright © 2015 David Thompson <davet@gnu.org> +;;; +;;; This file is part of Haunt. +;;; +;;; Haunt is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or +;;; (at your option) any later version. +;;; +;;; Haunt is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with Haunt. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: +;; +;; Haunt user interface. +;; +;;; Code: + +(define-module (haunt ui) + #:use-module (ice-9 format) + #:use-module (ice-9 match) + #:export (haunt-main)) + +(define (show-haunt-help) + (format #t "Usage: haunt COMMAND ARGS... +Run COMMAND with ARGS.~%~%")) + +(define (show-haunt-usage) + (format #t "Try `haunt --help' for more information.~%") + (exit 1)) + +(define (option? str) + (string-prefix? "-" str)) + +(define* (haunt-main arg0 . args) + (match args + (() + (show-haunt-usage)) + ((or ("-h") ("--help")) + (show-haunt-help)) + (((? option? opt) _ ...) + (format (current-error-port) + "haunt: unrecognized option '~a'~%" + opt) + (show-haunt-usage)))) |