squinnondation/squinnondation/squinnondation.py

28 lines
939 B
Python

# Copyright (C) 2020 by eichhornchen, ÿnérant
# SPDX-License-Identifier: GPL-3.0-or-later
from argparse import ArgumentParser, Namespace
class Squinnondation:
args: Namespace
client_address: str
client_port: int
def parse_arguments(self) -> None:
parser = ArgumentParser(description="MIRC client.")
parser.add_argument('address', type=str, default="localhost", help="Address of the client.")
parser.add_argument('port', type=int, default=2500, help="Port of the client. Must be between 1024 and 65535.")
self.args = parser.parse_args()
if not (1024 <= self.args.port <= 65535):
raise ValueError("The port must be between 1024 and 65535.")
self.client_address = self.args.address
self.client_port = self.args.port
@staticmethod
def main() -> None: # pragma: no cover
instance = Squinnondation()
instance.parse_arguments()