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