1
0
mirror of https://blitiri.com.ar/repos/chasquid synced 2025-12-17 14:37:02 +00:00

chasquid-util: Remove dependency on docopt-go

The docopt-go library is quite convenient, but it has been abandoned for
a while :(

Since we only use it for chasquid-util, this patch removes it and
replaces it with a custom small parser, that is a reasonable fit for the
required use cases.

The patch also adds a couple of tests to increase coverage.

NOTE: docopt-go accepted some undocumented behaviour, in particular the
use of "-a b" instead of "-a=b". The new parser does not, so some
user scripts may require updating.

I think this should be rare enough not to be worth the complexity of
adjusting the parser to allow it.
This commit is contained in:
Alberto Bertogli
2021-01-16 14:19:50 +00:00
parent def6e1cee2
commit 5c09138db8
6 changed files with 102 additions and 25 deletions

View File

@@ -65,9 +65,9 @@ function add_user() {
DOMAIN=$(echo $1 | cut -d @ -f 2)
mkdir -p "${CONFDIR}/domains/$DOMAIN/"
go run ${TBASE}/../../cmd/chasquid-util/chasquid-util.go \
-C "${CONFDIR}" \
-C="${CONFDIR}" \
user-add "$1" \
--password "$2" \
--password="$2" \
>> .add_user_logs
}