Rename set_opts arguments to on/off

This commit is contained in:
Juno Takano 2024-07-18 16:58:19 -03:00
parent ae206ccc3e
commit a6142163af
4 changed files with 16 additions and 6 deletions

View file

@ -8,9 +8,9 @@ package_manager() {
local args__get_manually_installed local args__get_manually_installed
local args__get_available local args__get_available
set_opts + set_opts off
local args__user_args="$2" local args__user_args="$2"
set_opts - set_opts on
if [ "$OS" = "FreeBSD" ]; then if [ "$OS" = "FreeBSD" ]; then
manager="pkg" manager="pkg"

View file

@ -1,7 +1,7 @@
update_package_cache() { update_package_cache() {
set_opts + set_opts off
local argument="$1" local argument="$1"
set_opts - set_opts on
if [ -f "$PACKAGE_CACHE" ]; then if [ -f "$PACKAGE_CACHE" ]; then
local last_update="$(date -r "$PACKAGE_CACHE" +%Y-%m-%d)" local last_update="$(date -r "$PACKAGE_CACHE" +%Y-%m-%d)"

View file

@ -44,7 +44,17 @@ log() {
} }
set_opts() { 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() { set_opt() {
local opt="$1" local opt="$1"

2
tori
View file

@ -21,7 +21,7 @@ main() {
check_core_paths check_core_paths
. "$TORI_ROOT/src/index.sh" . "$TORI_ROOT/src/index.sh"
set_opts - set_opts on
## os-dependent state ## os-dependent state
OS="$(get_operating_system)" OS="$(get_operating_system)"