aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorkaotisk <kaotisk@arching-kaos.org>2024-06-16 15:09:39 +0300
committerkaotisk <kaotisk@arching-kaos.org>2024-06-16 15:09:39 +0300
commit003fb850f911812538242ef2a2cac0915444f121 (patch)
treebd8107b9f50dcd54c7da4874d938a2c7274f1a41 /lib
parent35040ce82f432203182b2290bef4973bd11cae97 (diff)
downloadarching-kaos-tools-003fb850f911812538242ef2a2cac0915444f121.tar.gz
arching-kaos-tools-003fb850f911812538242ef2a2cac0915444f121.tar.bz2
arching-kaos-tools-003fb850f911812538242ef2a2cac0915444f121.zip
updates: ak-settings
- completed help text - returns error when a key isn't found while trying to get it - returns a warning when overwritting an already set key
Diffstat (limited to 'lib')
-rwxr-xr-xlib/_ak_settings9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/_ak_settings b/lib/_ak_settings
index ce0f9c4..500b34f 100755
--- a/lib/_ak_settings
+++ b/lib/_ak_settings
@@ -32,6 +32,11 @@ _ak_settings_get(){
_ak_log_error "Names containing symbols are not allowed"
exit 1
fi
+ if [ ! -f $AK_SETTINGS/$subset/$label ]
+ then
+ _ak_log_error "Key: $subset.$label was not found"
+ exit 1
+ fi
cat $AK_SETTINGS/$subset/$label
else
cd $AK_SETTINGS
@@ -77,6 +82,10 @@ _ak_settings_set(){
_ak_log_error "Names containing symbols are not allowed"
exit 1
fi
+ if [ -f $AK_SETTINGS/$subset/$label ]
+ then
+ _ak_log_warning "Overwritting $subset.$label:$(cat $AK_SETTINGS/$subset/$label) with $2"
+ fi
printf '%s' "$2" > $AK_SETTINGS/$subset/$label
else
_ak_log_error "No value provided for $1"