home · contact · privacy
Server/py: Add command line parser for replay option.
authorChristian Heller <c.heller@plomlompom.de>
Tue, 17 Feb 2015 01:56:06 +0000 (02:56 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Tue, 17 Feb 2015 01:56:06 +0000 (02:56 +0100)
plomrogue-server.py

index bcd985d22b6929c7605c5148ab1edf64ea14b537..1e4eda149eaa69451e865ca2dca1d2e0a6366bcb 100755 (executable)
@@ -1,3 +1,4 @@
+import argparse
 import errno
 import os
 import time
@@ -57,6 +58,11 @@ def detect_atomic_leftover(path):
 
 io_db = {}
 try:
+    parser = argparse.ArgumentParser(add_help=False)
+    parser.add_argument('-s', nargs='?', type=int, dest='replay', const=1,
+                        action='store')
+    args, unknown = parser.parse_known_args()
+    print("Replay: " + str(args.replay))
     print("DUMMY: Obey command-line arguments.")
     print("DUMMY: Open files.")
     setup_server_io(io_db)