From: Christian Heller Date: Tue, 17 Feb 2015 01:56:06 +0000 (+0100) Subject: Server/py: Add command line parser for replay option. X-Git-Tag: tce~528 X-Git-Url: https://plomlompom.com/repos/%22https:/validator.w3.org/%7B%7Bprefix%7D%7D/%7B%7Btodo.date%7D%7D?a=commitdiff_plain;h=0419c055322edc009c80e7bc3b33362d67b5ec50;p=plomrogue Server/py: Add command line parser for replay option. --- diff --git a/plomrogue-server.py b/plomrogue-server.py index bcd985d..1e4eda1 100755 --- a/plomrogue-server.py +++ b/plomrogue-server.py @@ -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)