From 1c067f83d88bca1c484240fd64abafdde46d6e5d Mon Sep 17 00:00:00 2001 From: furtest Date: Sat, 5 Jul 2025 22:51:14 +0200 Subject: [PATCH] Adds argparser for parsing CLI arguments --- src/unisync/argparser.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/unisync/argparser.py diff --git a/src/unisync/argparser.py b/src/unisync/argparser.py new file mode 100644 index 0000000..dda0eb0 --- /dev/null +++ b/src/unisync/argparser.py @@ -0,0 +1,22 @@ +# Copyright (C) 2025 Paul Retourné +# SPDX-License-Identifier: GPL-3.0-or-later + +import argparse + +def create_argparser() -> argparse.ArgumentParser: + parser = argparse.ArgumentParser( + prog='unisync', + description='File synchronisation application', + epilog=""" + Copyright © 2025 Paul Retourné. + License GPLv3+: GNU GPL version 3 or later .""" + ) + parser.add_argument("local", nargs="?") + parser.add_argument("remote", nargs="?") + + remote_addr_group = parser.add_mutually_exclusive_group() + remote_addr_group.add_argument("--ip") + remote_addr_group.add_argument("--hostname") + + parser.add_argument("--config", help="Path to the configuration file", metavar="path_to_config") + return parser