summaryrefslogtreecommitdiff
path: root/asciifarmclient/parseargs.py
diff options
context:
space:
mode:
authortroido <troido@protonmail.com>2021-01-23 16:07:08 +0100
committertroido <troido@protonmail.com>2021-01-23 16:07:08 +0100
commit3420305361c550cd1d57b277184d73d8b80cd76a (patch)
tree79e9a08d786f9b906343cb7599ebe701426fc67e /asciifarmclient/parseargs.py
parent6c897d8e4123899a3f9878a658fc1e9f8f7bfa51 (diff)
upgraded ratuil; fix special keyboard keys in curses client
Diffstat (limited to 'asciifarmclient/parseargs.py')
-rw-r--r--asciifarmclient/parseargs.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/asciifarmclient/parseargs.py b/asciifarmclient/parseargs.py
index 47fcfeb..00789d5 100644
--- a/asciifarmclient/parseargs.py
+++ b/asciifarmclient/parseargs.py
@@ -14,6 +14,8 @@ defaultAdresses = {
"abstract": "rustifarm",
"unix": "asciifarm.socket",
"inet": "localhost:9021",
+ "inet4": "localhost:9021",
+ "inet6": "localhost:9021"
}
def parse_args(argv):
@@ -26,7 +28,7 @@ def parse_args(argv):
~troido""", formatter_class=argparse.RawDescriptionHelpFormatter)
parser.add_argument('-n', '--name', help='Your player name (must be unique!). Defaults to username on inet sockets and tildename on unix socket (including abstract). Apart from the tilde in a tildename all characters must be unicode letters, numbers or connection puctuation. The maximum size of a name is 256 bytes when encoded as utf8', default=None)
parser.add_argument("-a", "--address", help="The address of the socket. When the socket type is 'abstract' this is just a name. When it is 'unix' this is a filename. When it is 'inet' is should be in the format 'address:port', eg 'localhost:8080'. Defaults depends on the socket type")
- parser.add_argument("-s", "--socket", help="the socket type. 'unix' is unix domain sockets, 'abstract' is abstract unix domain sockets and 'inet' is inet sockets. ", choices=["abstract", "unix", "inet"], default=("abstract" if sys.platform == "linux" else "inet"))
+ parser.add_argument("-s", "--socket", help="the socket type. 'unix' is unix domain sockets, 'abstract' is abstract unix domain sockets and 'inet' is inet sockets. ", choices=["abstract", "unix", "inet", "inet4", "inet6"], default=("abstract" if sys.platform == "linux" else "inet"))
parser.add_argument('-k', '--keybindings', help='The file with the keybinding configuration. This file is a JSON file.', default="default")
parser.add_argument('-c', '--characters', help='The file with the character mappings for the graphics. If it is either of these names: {} it will be loaded from the charmaps directory.'.format(list(loaders.standardCharFiles.keys())), default="default")
parser.add_argument('-o', '--logfile', help='All game messages will be written to this file.', default=None)
@@ -49,9 +51,11 @@ def parse_args(argv):
address = defaultAdresses[args.socket]
if args.socket == "abstract":
address = '\0' + address
- elif args.socket == "inet":
- hostname, sep, port = address.rpartition(':')
+ elif args.socket == "inet" or args.socket == "inet6" or args.socket == "inet4":
+ hostname, _sep, port = address.rpartition(':')
address = (hostname, int(port))
+
+
colours = True
if args.colours: