From: Eric S. Raymond Date: Tue, 30 Nov 2010 10:19:08 +0000 (+0000) Subject: Add a -V option. X-Git-Tag: 2.0~13 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=05ea818fc8edd266921db74a06211a074c5ae2a0;p=super-star-trek.git Add a -V option. --- diff --git a/doc/sst.xml b/doc/sst.xml index bd7259b..78104ba 100644 --- a/doc/sst.xml +++ b/doc/sst.xml @@ -18,6 +18,7 @@ -r filename -t -x + -V command @@ -51,6 +52,8 @@ from stdin as normal. The -r option forces -t mode. The option -x enables some debugging features of interest probably only to sst2k developers. +With -V, the program emits its version and exits. + Input tokens for the setup prompts will be read from the remainder of the command line before standard input. Thus, for example, you can invoke the program as diff --git a/sst.py b/sst.py index a576664..5bc4bac 100644 --- a/sst.py +++ b/sst.py @@ -13,6 +13,8 @@ on how to modify (and how not to modify!) this code. """ import os, sys, math, curses, time, readline, cPickle, random, copy, gettext, getpass +version="2.0" + docpath = (".", "../doc", "/usr/share/doc/sst") def _(str): return gettext.gettext(str) @@ -6255,7 +6257,7 @@ if __name__ == '__main__': else: game.options |= OPTION_TTY seed = int(time.time()) - (options, arguments) = getopt.getopt(sys.argv[1:], "r:s:tx") + (options, arguments) = getopt.getopt(sys.argv[1:], "r:s:txV") for (switch, val) in options: if switch == '-r': try: @@ -6282,6 +6284,9 @@ if __name__ == '__main__': game.options &=~ OPTION_CURSES elif switch == '-x': idebug = True + elif switch == '-V': + print "SST2K", version + raise SystemExit, 0 else: sys.stderr.write("usage: sst [-t] [-x] [startcommand...].\n") raise SystemExit, 1