From d7d8728b9df5d22ba88666fe17f62e8b79d6446a Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Thu, 6 Jan 2022 19:53:38 +0300 Subject: db.sh: consistent logging --- src/db.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/db.sh b/src/db.sh index 5eb1697..d987e85 100644 --- a/src/db.sh +++ b/src/db.sh @@ -272,7 +272,7 @@ chmod_entries() { local mode="$1" shift - echo "Applying mode $mode to shared files..." + dump "applying mode $mode to shared files..." if [ "${#shared_paths[@]}" -ne 0 ]; then is_dry_run || chmod -- "$mode" ${shared_paths[@]+"${shared_paths[@]}"} fi -- cgit v1.2.3 From 47c8a75f97f21ae6cffa61e61e62000642f82ab7 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Thu, 6 Jan 2022 20:11:05 +0300 Subject: db.sh: add parse_mode function --- src/db.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src') diff --git a/src/db.sh b/src/db.sh index d987e85..b057202 100644 --- a/src/db.sh +++ b/src/db.sh @@ -263,6 +263,23 @@ unlink_obsolete_entries() { done } +parse_mode() { + if [ "$#" -ne 1 ]; then + echo "usage: ${FUNCNAME[0]} MODE" >&2 + return 1 + fi + + local mode="$1" + shift + + if [ -z "$mode" ]; then + dump "mode cannot be empty" >&2 + return 1 + fi + + echo "$mode" +} + chmod_entries() { if [ "$#" -ne 1 ]; then echo "usage: ${FUNCNAME[0]} MODE" >&2 -- cgit v1.2.3