summaryrefslogtreecommitdiff
path: root/haunt/ui.scm
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2015-01-04 22:47:05 -0500
committerDavid Thompson <dthompson2@worcester.edu>2015-01-04 22:50:01 -0500
commit2a878fd9ee2d99cf3112768449e4a0c4c3e77d8b (patch)
treecfe23e4f50045ca34bdb358f254e24e27ec9b81e /haunt/ui.scm
parentf299cca70928759f04d44d81d6c2f0f6f9388e1b (diff)
ui: Display version information.
* haunt/config.scm: Delete. * haunt/config.scm.in: New file. * haunt/ui.scm (show-version-and-exit): New procedure. (program-name): Change default value. (haunt-main): Add version option. * haunt/ui/serve.scm (haunt-serve): Likewise. * configure.ac (AC_CONFIG_FILES): Add 'haunt/config.scm'. * .gitignore: Ignore 'haunt/config.scm'.
Diffstat (limited to 'haunt/ui.scm')
-rw-r--r--haunt/ui.scm19
1 files changed, 17 insertions, 2 deletions
diff --git a/haunt/ui.scm b/haunt/ui.scm
index 35e8eb3..910adf9 100644
--- a/haunt/ui.scm
+++ b/haunt/ui.scm
@@ -9,7 +9,7 @@
;;; (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
+;;; WITnnnHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;;; General Public License for more details.
;;;
@@ -27,15 +27,17 @@
#:use-module (ice-9 ftw)
#:use-module (ice-9 match)
#:use-module (srfi srfi-26)
+ #:use-module (haunt config)
#:export (program-name
haunt-error
+ show-version-and-exit
option?
haunt-main))
(define commands
'(serve))
-(define program-name (make-parameter "haunt"))
+(define program-name (make-parameter 'haunt))
(define (haunt-error str . args)
(format (current-error-port) "~a: " (program-name))
@@ -52,6 +54,17 @@ Run COMMAND with ARGS.~%~%")
(format #t "Try `haunt --help' for more information.~%")
(exit 1))
+(define (show-version-and-exit)
+ (let ((name (if (eq? (program-name) 'haunt)
+ "haunt"
+ (format #f "haunt ~a" (program-name)))))
+ (format #t "~a ~a
+Copyright (C) 2015 the Haunt authors
+License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
+This is free software: you are free to change and redistribute it.
+There is NO WARRANTY, to the extent permitted by law.~%"
+ name %haunt-version)))
+
(define (option? str)
(string-prefix? "-" str))
@@ -73,6 +86,8 @@ Run COMMAND with ARGS.~%~%")
(show-haunt-usage))
((or ("-h") ("--help"))
(show-haunt-help))
+ (("--version")
+ (show-version-and-exit))
(((? option? opt) _ ...)
(format (current-error-port)
"haunt: unrecognized option '~a'~%"