Add function for configuring user settings

This commit is contained in:
Manuel Thalmann 2024-07-20 03:50:38 +02:00
parent 675db97522
commit a89d9bb677
3 changed files with 26 additions and 2 deletions

View file

@ -1,7 +1,7 @@
#!/bin/env fish
set -l dir (status dirname)
source "$dir/../Scripts/config.fish"
set -l users (getConfig valhalla.users --apply "builtins.attrNames" --json)
set -l users (getUsers)
for name in (echo "$users" | jq '.[]' --raw-output0 | string split0)

View file

@ -4,6 +4,10 @@ function getConfig -S -a property
evalModule "$CONFIG_MODULE" "$property" $argv[2..]
end
function getUsers -S
getConfig valhalla.users --apply "builtins.attrNames" --json
end
function isSet -S -a property
not test "$(getConfig "$property" --json)" = "null"
end

View file

@ -1,16 +1,36 @@
#!/bin/env fish
begin
set -l dir (status dirname)
function installSW
end
function configureSW
end
function runInstaller -a action
function userConfig -a user
end
function runInstaller -V dir -a action
if [ -z "$action" ] || [ "$action" = "install" ]
installSW $argv[2..]
else if [ "$action" = "configure" ]
configureSW $argv[2..]
source "$dir/config.fish"
set -l users (getUsers)
for name in (echo "$users" | jq '.[]' --raw-output0 | string split0)
runInstaller userConfig "$name"
end
else if [ "$action" = "userConfig" ]
set -l name $argv[2]
if [ -z "$name" ]
set name "$USER"
end
userConfig "$name" $argv[3..]
end
end
end