PortValhalla/scripts/Common/Scripts/config.fish

35 lines
806 B
Fish
Raw Normal View History

2024-07-09 00:22:12 +00:00
#!/bin/env fish
function isConfigured -S
2024-09-08 15:09:01 +00:00
set -q CONFIG_NAME
end
function getProfiles -S
source "$(status dirname)/eval-flake.fish";
evalFlake "" "" --apply "builtins.attrNames" --json
end
2024-07-09 00:22:12 +00:00
function getConfig -S -a property
2024-09-08 15:09:01 +00:00
source "$(status dirname)/eval-flake.fish"
evalFlake "$CONFIG_NAME" "$property" $argv[2..]
2024-07-09 00:22:12 +00:00
end
2024-07-15 10:10:06 +00:00
function getAttributes -S -a property
getConfig "$property" --apply "builtins.attrNames" --json
end
function getUsers -S
getAttributes "valhalla.users"
end
function isSet -S -a property
not test "$(getConfig "$property" --json)" = "null"
end
function isEnabled -S -a property
getConfig "$property" --json | jq --exit-status > /dev/null
end
2024-07-15 10:10:06 +00:00
function collectionActive -S -a name
[ "$(getConfig "valhalla.software.$name" --json)" = "true" ]
end