summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sly/cli.scm15
-rw-r--r--sly/config.scm.in3
2 files changed, 18 insertions, 0 deletions
diff --git a/sly/cli.scm b/sly/cli.scm
index b4040d0..49b5070 100644
--- a/sly/cli.scm
+++ b/sly/cli.scm
@@ -19,6 +19,7 @@
#:use-module (ice-9 format)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-37)
+ #:use-module (sly config)
#:use-module (sly game)
#:use-module (sly input keyboard)
#:use-module (sly repl)
@@ -77,6 +78,10 @@
(lambda _
(show-help)
(exit 0)))
+ (option '(#\V "version") #f #f
+ (lambda _
+ (show-version)
+ (exit 0)))
(option '(#\d "develop") #f #f
(lambda (opt name arg result)
(alist-cons 'develop? #t result)))))
@@ -85,9 +90,19 @@
(display "Usage: sly [OPTION]... GAME-DIRECTORY
Run the Sly game located in GAME-DIRECTORY.\n")
(display "
+ -v, --version Display version information")
+ (display "
-d, --develop Run in development mode")
(newline))
+(define (show-version)
+ (format #t "sly ~a~%" %sly-version)
+ (display "Copyright (C) 2016 the Sly 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.")
+ (newline))
+
(define (sly-main args)
(let* ((opts (args-fold args
%options
diff --git a/sly/config.scm.in b/sly/config.scm.in
index 46f8bfe..cd70d63 100644
--- a/sly/config.scm.in
+++ b/sly/config.scm.in
@@ -23,11 +23,14 @@
(define-module (sly config)
#:export (%datadir
+ %sly-version
scope-datadir))
(define %datadir
(or (getenv "SLY_DATADIR") "@sly_datadir@/sly"))
+(define %sly-version "@PACKAGE_VERSION@")
+
(define (scope-datadir file)
"Append the Sly data directory to FILE."
(string-append %datadir file))