From a6142163af0de1708e54b1bf971ed1d09b398193 Mon Sep 17 00:00:00 2001 From: jutty Date: Thu, 18 Jul 2024 16:58:19 -0300 Subject: [PATCH] Rename set_opts arguments to on/off --- src/package/package_manager.sh | 4 ++-- src/package/update_package_cache.sh | 4 ++-- src/utility.sh | 12 +++++++++++- tori | 2 +- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/package/package_manager.sh b/src/package/package_manager.sh index 10930ca..f96f132 100644 --- a/src/package/package_manager.sh +++ b/src/package/package_manager.sh @@ -8,9 +8,9 @@ package_manager() { local args__get_manually_installed local args__get_available - set_opts + + set_opts off local args__user_args="$2" - set_opts - + set_opts on if [ "$OS" = "FreeBSD" ]; then manager="pkg" diff --git a/src/package/update_package_cache.sh b/src/package/update_package_cache.sh index 1169508..c01b750 100644 --- a/src/package/update_package_cache.sh +++ b/src/package/update_package_cache.sh @@ -1,7 +1,7 @@ update_package_cache() { - set_opts + + set_opts off local argument="$1" - set_opts - + set_opts on if [ -f "$PACKAGE_CACHE" ]; then local last_update="$(date -r "$PACKAGE_CACHE" +%Y-%m-%d)" diff --git a/src/utility.sh b/src/utility.sh index 81ae419..441ed38 100644 --- a/src/utility.sh +++ b/src/utility.sh @@ -44,7 +44,17 @@ log() { } set_opts() { - sign="$1" + local target="$1" + local sign= + + if [ "$target" = on ]; then + sign='-' + elif [ "$target" = off ]; then + sign='+' + else + log fatal "Invalid set_opts target: $target. Expected on or off" + return 1 + fi set_opt() { local opt="$1" diff --git a/tori b/tori index ac5c3ee..0f59126 100755 --- a/tori +++ b/tori @@ -21,7 +21,7 @@ main() { check_core_paths . "$TORI_ROOT/src/index.sh" - set_opts - + set_opts on ## os-dependent state OS="$(get_operating_system)"