[game-data-packager] 132/293: supporting help and adding a manpage

Simon McVittie smcv at debian.org
Fri Oct 14 00:12:06 UTC 2016


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to branch quake
in repository game-data-packager.

commit 935597815e96d125cc307eafbe6aedb0eec0c2b6
Author: David Banks <amoebae at gmail.com>
Date:   Wed Jun 22 17:03:40 2011 +0100

    supporting help and adding a manpage
---
 debian/quake.manpages |  1 +
 quake.6               | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++
 quake.sh              | 50 +++++++++++++++++++++++++++++++++----
 3 files changed, 115 insertions(+), 5 deletions(-)

diff --git a/debian/quake.manpages b/debian/quake.manpages
new file mode 100644
index 0000000..2aa22a8
--- /dev/null
+++ b/debian/quake.manpages
@@ -0,0 +1 @@
+quake.6
diff --git a/quake.6 b/quake.6
new file mode 100644
index 0000000..43f01f9
--- /dev/null
+++ b/quake.6
@@ -0,0 +1,69 @@
+.\"                                      Hey, EMACS: -*- nroff -*-
+.\" First parameter, NAME, should be all caps
+.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
+.\" other parameters are allowed: see man(7), man(1)
+.TH QUAKE 6 "2011-06-22"
+.\" Please adjust this date whenever revising the manpage.
+.\"
+.\" Some roff macros, for reference:
+.\" .nh        disable hyphenation
+.\" .hy        enable hyphenation
+.\" .ad l      left justify
+.\" .ad b      justify to both left and right margins
+.\" .nf        disable filling
+.\" .fi        enable filling
+.\" .br        insert line break
+.\" .sp <n>    insert n+1 empty lines
+.\" for manpage-specific macros, see man(7)
+.SH NAME
+quake \- classic first person shooter
+.SH SYNOPSIS
+.B quake
+.RI [ WRAPPER-OPTIONS ]
+.RI [ ENGINE-OPTIONS ]
+.RI [ ENGINE-COMMANDS ] ...
+.br
+.SH DESCRIPTION
+This manual page documents briefly the
+.B quake
+command.
+.PP
+.\" TeX users may be more comfortable with the \fB<whatever>\fP and
+.\" \fI<whatever>\fP escape sequences to invode bold face and italics,
+.\" respectively.
+\fBQuake\fP is a popular first-person shooter game that appeared in 1996,
+released by iD Software.  This wrapper script will launch the Quake engine.  The
+game data needs to be installed independently using the 'game-data-packager'
+program, and by default it will be looked for at \fI/usr/share/games/quake\fR.
+.PP
+This wrapper script accepts the two common GNU-style options to get information
+on the program.  Any further arguments are passed to the engine unmodified.
+Consult the engine documentation for full details, but most engines support a
+syntax whereby engine switches are prefixed with a minus sign, and you can
+give console commands by prefixing with a plus sign.  See the examples section
+for some common cases.
+.SH OPTIONS
+These options are accepted for \fBWRAPPER-OPTIONS\fR in the
+synopsis.
+.TP
+.B \-h, \-\-help
+Show summary of options.
+.TP
+.B \-v, \-\-version
+Show version of program.
+.SH EXAMPLES
+These are all engine dependent.
+.PP
+Play the Zerstoerer mod:
+.B quake -game mod
+Play a specific map using the Drake expansion:
+.B quake -game drake +map sludge1
+Connect to a server for multiplayer:
+.B quake +connect dm.quakeone.net:27000
+.SH SEE ALSO
+.BR quakespasm (6),
+.BR game-data-packager (6).
+.SH AUTHOR
+This manual page, and the Quake wrapper script, were written by David Banks
+<amoebae at gmail.com>, for the Debian project (and may be used by others).  The
+package was based on the \fBquake3\fR package by Simon McVittie.
diff --git a/quake.sh b/quake.sh
index 22fe0f1..b3a5934 100644
--- a/quake.sh
+++ b/quake.sh
@@ -4,11 +4,51 @@
 
 data_location=/usr/share/games/quake
 engine_path=/usr/games/quakespasm
-
 no_data_msg="Missing data; see /usr/share/doc/quake/README.Debian"
 
-if ! [ -f "${data_location}/id1/pak0.pak" ]; then
-    exec "$data_location"/need-data.sh "$no_data_msg"
-fi
+main() {
+    while [ $# -gt 0 ]; do
+        case "$1" in
+            -h|--help)
+                show_help
+                exit 2
+                ;;
+            -v|--version)
+                show_version
+                exit 2
+                ;;
+            *)
+                break
+                ;;
+        esac
+
+        shift
+    done
+
+    if ! [ -f "${data_location}/id1/pak0.pak" ]; then
+        exec "$data_location"/need-data.sh "$no_data_msg"
+    fi
+    
+    exec ${engine_path} -basedir ${data_location} "$@"
+}
+
+show_help() {
+    echo "Usage: quake [-h|--help] [-v|--version] [ARG1] [ARG2] ..."
+    echo "Launch Quake."
+    echo
+    echo "This script supports these options:"
+    echo "  -h, --help       show this help information"
+    echo "  -v, --version    show version information"
+    echo
+    echo "Any further arguments will be passed directly to the Quake engine."
+}
+
+show_version() {
+    echo "Debian Quake 1 wrapper script"
+    echo "Please consult your apt database for the version number of this script."
+    echo "Looking for data at: '$data_location'"
+    echo "Using engine: '$engine_path'"
+}
+
+main "$@"
 
-exec ${engine_path} -basedir ${data_location}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/game-data-packager.git



More information about the Pkg-games-commits mailing list