From 713aa138b598a48de5fee23d3f74c985878fa6ad Mon Sep 17 00:00:00 2001 From: Valentin Lab Date: Mon, 2 Dec 2024 22:09:24 +0100 Subject: [PATCH] new: [vps] make ``vps restore`` have debug mode, color of ``compose`` commnds --- bin/vps | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/bin/vps b/bin/vps index 3b075aa..7e04150 100755 --- a/bin/vps +++ b/bin/vps @@ -1773,8 +1773,9 @@ cmdline.spec.gnu dump cmdline.spec:odoo:cmd:dump:run() { : :posarg: DUMP_ZIPFILE 'Target path to store odoo dump zip file.' - : :optval: --database,-d 'Target database (default if not specified)' + : :optval: --database,-D 'Target database (default if not specified)' : :optval: --service,-s "The service (defaults to 'odoo')" + : :optfla: --debug,-d "Display debugging information" odoo_service="${opt_service:-odoo}" @@ -1782,8 +1783,16 @@ cmdline.spec:odoo:cmd:dump:run() { msg_dbname=default [ -n "$opt_database" ] && msg_dbname="'$opt_database'" - compose --no-hooks save "$odoo_service" $opt_database > "$DUMP_ZIPFILE" || { - err "Error dumping ${DARKYELLOW}$odoo_service${NORMAL}'s $msg_dbname database to '$DUMP_ZIPFILE'." + + opts_compose=() + [ -t 1 ] && opts_compose+=("--color") + [ "$opt_debug" ] && { + VERBOSE=1 + opts_compose+=("--debug") + } + + compose --no-hooks "${opts_compose[@]}" save "$odoo_service" $opt_database > "$DUMP_ZIPFILE" || { + err "Failed dumping ${DARKYELLOW}$odoo_service${NORMAL}'s $msg_dbname database to '$DUMP_ZIPFILE'." exit 1 }