Add functions for retrieving attributes

This commit is contained in:
Manuel Thalmann 2024-08-08 14:45:34 +02:00
parent 4aec5d4b53
commit 6cd1cbb541
2 changed files with 24 additions and 3 deletions

View file

@ -91,11 +91,28 @@ $null = New-Module {
The name of the option to get.
#>
function Get-Config {
param(
[string] $Name,
[Parameter(ValueFromRemainingArguments)]
[string[]] $ArgumentList
)
Invoke-ConfigScript "getConfig $Name --json $ArgumentList";
}
<#
.SYNOPSIS
Gets the attributes of a configuration object.
.PARAMETER Name
The name of the configuration to get the attributes of.
#>
function Get-Attributes {
param(
[string] $Name
)
Invoke-ConfigScript "getConfig $Name --json";
Invoke-ConfigScript "getAttributes $Name";
}
<#
@ -103,7 +120,7 @@ $null = New-Module {
Gets the names of the users to create.
#>
function Get-Users {
Invoke-ConfigScript "getUsers";
Get-Attributes "valhalla.windows.users";
}
<#

View file

@ -8,8 +8,12 @@ function getConfig -S -a property
evalModule "$CONFIG_MODULE" "$property" $argv[2..]
end
function getAttributes -S -a property
getConfig "$property" --apply "builtins.attrNames" --json
end
function getUsers -S
getConfig valhalla.users --apply "builtins.attrNames" --json
getAttributes "valhalla.users"
end
function isSet -S -a property