From 9774045dcf47bd6468884113cc84bda7ed657938 Mon Sep 17 00:00:00 2001 From: Daniel Langbein Date: Wed, 28 Jun 2023 19:51:09 +0200 Subject: [PATCH] docs: add usage --- README.md | 22 ++++++++++++++++++++++ src/netcup_dns/main.py | 5 +++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 83647fb..1693744 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,28 @@ For each netcup customer, create a `.json` configuration file inside `/etc/netcu There is an [example configuration](cfg/example.json). +## Usage + +``` +usage: netcup-dns [-h] [--config-directory CFG_DIR] + [--cache-directory CACHE_DIR] + [--cache-validity-seconds CACHE_VALIDITY_SECONDS] + +Update DNS A/AAAA records with your current external IP address using the +netcup DNS API. + +options: + -h, --help show this help message and exit + --config-directory CFG_DIR + Path to directory where `.json` config files reside. + --cache-directory CACHE_DIR + Path to cache directory. Retrieved and updated DNS + records are cached there. + --cache-validity-seconds CACHE_VALIDITY_SECONDS + Value in seconds for how long cached DNS records are + valid. Set to `0` to disable caching. +``` + ## TODOs Alternative external IP detection: diff --git a/src/netcup_dns/main.py b/src/netcup_dns/main.py index 417c4db..7f91d1c 100644 --- a/src/netcup_dns/main.py +++ b/src/netcup_dns/main.py @@ -57,7 +57,8 @@ def main(): def parse_args(): - parser = argparse.ArgumentParser(description='Update DNS A/AAAA records with your current external IP address' + parser = argparse.ArgumentParser(prog='netcup-dns', + description='Update DNS A/AAAA records with your current external IP address' ' using the netcup DNS API.') parser.add_argument('--config-directory', help='Path to directory where `.json` config files reside.', @@ -65,7 +66,7 @@ def parse_args(): default=Path('/etc/netcup-dns'), type=Path) parser.add_argument('--cache-directory', - help='Path to cache directory. Retrieved/Set DNS records are cached there.', + help='Path to cache directory. Retrieved and updated DNS records are cached there.', dest='cache_dir', default=Path.home().joinpath('.netcup-dns/cache'), type=Path)