diff --git a/scripts/Windows/Scripts/Config.ps1 b/scripts/Windows/Scripts/Config.ps1 index 311b13b7..2c2cc670 100644 --- a/scripts/Windows/Scripts/Config.ps1 +++ b/scripts/Windows/Scripts/Config.ps1 @@ -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"; } <#