projects
/
super-star-trek.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
f5dbc11
)
Add a -V option.
author
Eric S. Raymond
<esr@thyrsus.com>
Tue, 30 Nov 2010 10:19:08 +0000
(10:19 +0000)
committer
Eric S. Raymond
<esr@thyrsus.com>
Tue, 30 Nov 2010 10:19:08 +0000
(10:19 +0000)
doc/sst.xml
patch
|
blob
|
history
sst.py
patch
|
blob
|
history
diff --git
a/doc/sst.xml
b/doc/sst.xml
index bd7259b94545f1f2b0a3bfedf79cddf9b2b021b0..78104ba69b74b10010730f39b281c6c940ef4e1e 100644
(file)
--- a/
doc/sst.xml
+++ b/
doc/sst.xml
@@
-18,6
+18,7
@@
<arg choice='opt'>-r <replaceable>filename</replaceable></arg>
<arg choice='opt'>-t </arg>
<arg choice='opt'>-x </arg>
<arg choice='opt'>-r <replaceable>filename</replaceable></arg>
<arg choice='opt'>-t </arg>
<arg choice='opt'>-x </arg>
+ <arg choice='opt'>-V </arg>
<arg rep='repeat' ><replaceable>command</replaceable></arg>
</cmdsynopsis>
<arg rep='repeat' ><replaceable>command</replaceable></arg>
</cmdsynopsis>
@@
-51,6
+52,8
@@
from stdin as normal. The -r option forces -t mode.</para>
<para>The option -x enables some debugging features of interest
probably only to sst2k developers.</para>
<para>The option -x enables some debugging features of interest
probably only to sst2k developers.</para>
+<para>With -V, the program emits its version and exits.</para>
+
<para>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</para>
<para>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</para>
diff --git
a/sst.py
b/sst.py
index a5766646964608a12729b559b89f40a62fce50a1..5bc4bac3fe31fc27db8d0ebf272f251edf5b1611 100644
(file)
--- 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
"""
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)
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())
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:tx
V
")
for (switch, val) in options:
if switch == '-r':
try:
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
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
else:
sys.stderr.write("usage: sst [-t] [-x] [startcommand...].\n")
raise SystemExit, 1