Add a function for getting the users to create

This commit is contained in:
Manuel Thalmann 2024-08-01 17:56:42 +02:00
parent 603fbdfe46
commit 3a5e8556c5

View file

@ -61,6 +61,27 @@ $null = New-Module {
return $key;
}
<#
.SYNOPSIS
Runs a script based on the `config.fish` script.
.PARAMETER Script
The script to run.
#>
function Invoke-ConfigScript {
param(
[string] $Script
)
$scriptPath = "$PSScriptRoot/../../Common/Scripts/config.fish";
function fish {
wsl -- nix --extra-experimental-features "nix-command flakes" nixpkgs`#fish $args
}
fish -c ". $(ConvertTo-LinuxPath $scriptPath); $Script" | ConvertFrom-Json;
}
<#
.SYNOPSIS
Gets a configuration option.
@ -73,13 +94,15 @@ $null = New-Module {
[string] $Name
)
$scriptPath = "$PSScriptRoot/../../Common/Scripts/config.fish";
Invoke-ConfigScript "getConfig $Name --json";
}
function fish {
wsl -- nix --extra-experimental-features "nix-command flakes" nixpkgs`#fish $args
}
fish -c ". $(ConvertTo-LinuxPath $scriptPath); getConfig $Name --json" | ConvertFrom-Json;
<#
.SYNOPSIS
Gets the names of the users to create.
#>
function Get-Users {
Invoke-ConfigScript "getUsers";
}
<#