diff --git a/CHANGELOG.md b/CHANGELOG.md index e5f635c..fbbf629 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ ### New +* :sparkles: add completion. [Eduard Veit] + + :sparkles: add man page + * :sparkles: replace getopt with argbash. [Eduard Veit] * :sparkles: add interpretaton of status codes and act accordingly. [Eduard Veit] diff --git a/_dynb.sh b/_dynb.sh new file mode 100755 index 0000000..db92f12 --- /dev/null +++ b/_dynb.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +# Put this file to /etc/bash_completion.d/dynb.sh +# needed because of Argbash --> m4_ignore([ +### START OF CODE GENERATED BY Argbash v2.10.0 one line above ### +# Argbash is a bash code generator used to get arguments parsing right. +# Argbash is FREE SOFTWARE, see https://argbash.io for more info + +_dynb_sh () +{ + local cur prev opts base + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + all_long_opts="--version --link --reset --debug --update-method --ip-mode --domain --service-provider --username --password --token --help " + all_short_opts="-v -l -r -m -i -d -s -u -p -t -h " + case "$prev" in + --update-method|-m|--ip-mode|-i|--domain|-d|--service-provider|-s|--username|-u|--password|-p|--token|-t) + COMPREPLY=( $(compgen -o bashdefault -o default -- "${cur}") ) + return 0 + ;; + *) + case "$cur" in + --*) + COMPREPLY=( $(compgen -W "${all_long_opts}" -- "${cur}") ) + return 0 + ;; + -*) + COMPREPLY=( $(compgen -W "${all_short_opts}" -- "${cur}") ) + return 0 + ;; + *) + COMPREPLY=( $(compgen -o bashdefault -o default -- "${cur}") ) + return 0 + ;; + esac + esac + +} +complete -F _dynb_sh dynb.sh dynb +### END OF CODE GENERATED BY Argbash (sortof) ### ]) diff --git a/man/dynb.1 b/man/dynb.1 new file mode 100644 index 0000000..2747729 --- /dev/null +++ b/man/dynb.1 @@ -0,0 +1,109 @@ +.\" Man page generated from reStructuredText. +. +.TH MAN 1 "2021-04-03" "" "" +.SH NAME +man \- DynB - dynamic DNS update script for bash +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.sp +\fBman [\-\-version] [\-\-link] [\-\-reset] [\-\-debug] [\-\-update\-method UPDATE\-METHOD] [\-\-ip\-mode IP\-MODE] [\-\-domain DOMAIN] [\-\-service\-provider SERVICE\-PROVIDER] [\-\-username USERNAME] [\-\-password PASSWORD] [\-\-token TOKEN] [\-\-help]\fP +.SH DESCRIPTION +.sp +IPv4 (A) and IPv6 (AAAA) record updates are supported. +.SH ARGUMENTS +.INDENT 0.0 +.TP +.B \-v\fP,\fB \-\-version +outputs the client version. +[Default: off] +.sp + +.TP +.B \-l\fP,\fB \-\-link +links to your script at ~/.local/bin/dynb. +[Default: off] +.sp + +.TP +.B \-r\fP,\fB \-\-reset +deletes the client blocking status file. +[Default: off] +.sp + +.TP +.B \-\-debug +enables debug mode. +[Default: off] +.sp + +.TP +.BI \-m \ UPDATE\-METHOD\fR,\fB \ \-\-update\-method \ UPDATE\-METHOD +choose if you want to use DynDNS2 or the DomRobot RPC\-API. +.sp +dyndns | domrobot +.TP +.BI \-i \ IP\-MODE\fR,\fB \ \-\-ip\-mode \ IP\-MODE +updates type A (IPv4) and AAAA (IPv6) records. +.sp +4 | 6 | dual +.TP +.BI \-d \ DOMAIN\fR,\fB \ \-\-domain \ DOMAIN +set the domain you want to update. +.sp +dyndns.example.com +.TP +.BI \-s \ SERVICE\-PROVIDER\fR,\fB \ \-\-service\-provider \ SERVICE\-PROVIDER +set your provider in case you are using DynDNS2. +.sp +inwx | dynv6 +.TP +.BI \-u \ USERNAME\fR,\fB \ \-\-username \ USERNAME +depends on your selected update method and your provider. +.sp +e.g. user42 +.TP +.BI \-p \ PASSWORD\fR,\fB \ \-\-password \ PASSWORD +depends on your selected update method and your provider. +.sp +e.g. SuperSecretPassword +.TP +.BI \-t \ TOKEN\fR,\fB \ \-\-token \ TOKEN +depends on your selected update method and your provider. +.sp +YourProviderGivenToken +.TP +.B \-h\fP,\fB \-\-help +Prints help. +.sp + +.UNINDENT +.SH AUTHOR +Eduard Veit +.\" Generated by docutils manpage writer. +. diff --git a/man/man-defs.rst b/man/man-defs.rst new file mode 100644 index 0000000..d1f0707 --- /dev/null +++ b/man/man-defs.rst @@ -0,0 +1,33 @@ + +.. |AUTHOR| replace:: Eduard Veit + +.. |VERSION| replace:: \ + +.. |MAN_SECTION| replace:: 1 + +.. |DESCRIPTION| replace:: + IPv4 (A) and IPv6 (AAAA) record updates are supported. + +.. |OPTION_VERSION| replace:: \ + +.. |OPTION_LINK| replace:: \ + +.. |OPTION_RESET| replace:: \ + +.. |OPTION_DEBUG| replace:: \ + +.. |OPTION_UPDATE_METHOD| replace:: dyndns | domrobot + +.. |OPTION_IP_MODE| replace:: 4 | 6 | dual + +.. |OPTION_DOMAIN| replace:: dyndns.example.com + +.. |OPTION_SERVICE_PROVIDER| replace:: inwx | dynv6 + +.. |OPTION_USERNAME| replace:: e.g. user42 + +.. |OPTION_PASSWORD| replace:: e.g. SuperSecretPassword + +.. |OPTION_TOKEN| replace:: YourProviderGivenToken + +.. |OPTION_HELP| replace:: \ diff --git a/man/man-template.rst b/man/man-template.rst new file mode 100644 index 0000000..50089f1 --- /dev/null +++ b/man/man-template.rst @@ -0,0 +1,84 @@ + +.. include:: man-defs.rst + + +=== +man +=== + +----------------------------------------- +DynB - dynamic DNS update script for bash +----------------------------------------- + +:Author: |AUTHOR| +:Date: 2021-04-03 +:Version: |VERSION| +:Manual section: |MAN_SECTION| + + +SYNOPSIS +======== + +``man [--version] [--link] [--reset] [--debug] [--update-method UPDATE-METHOD] [--ip-mode IP-MODE] [--domain DOMAIN] [--service-provider SERVICE-PROVIDER] [--username USERNAME] [--password PASSWORD] [--token TOKEN] [--help]`` + + +DESCRIPTION +=========== + +|DESCRIPTION| + + +ARGUMENTS +========= + +-v, --version outputs the client version. + [Default: off] + + |OPTION_VERSION| + +-l, --link links to your script at ~/.local/bin/dynb. + [Default: off] + + |OPTION_LINK| + +-r, --reset deletes the client blocking status file. + [Default: off] + + |OPTION_RESET| + +--debug enables debug mode. + [Default: off] + + |OPTION_DEBUG| + +-m UPDATE-METHOD, --update-method UPDATE-METHOD choose if you want to use DynDNS2 or the DomRobot RPC-API. + + |OPTION_UPDATE_METHOD| + +-i IP-MODE, --ip-mode IP-MODE updates type A (IPv4) and AAAA (IPv6) records. + + |OPTION_IP_MODE| + +-d DOMAIN, --domain DOMAIN set the domain you want to update. + + |OPTION_DOMAIN| + +-s SERVICE-PROVIDER, --service-provider SERVICE-PROVIDER set your provider in case you are using DynDNS2. + + |OPTION_SERVICE_PROVIDER| + +-u USERNAME, --username USERNAME depends on your selected update method and your provider. + + |OPTION_USERNAME| + +-p PASSWORD, --password PASSWORD depends on your selected update method and your provider. + + |OPTION_PASSWORD| + +-t TOKEN, --token TOKEN depends on your selected update method and your provider. + + |OPTION_TOKEN| + +-h, --help Prints help. + + |OPTION_HELP|