Fix profile script for individual profiles

This commit is contained in:
Manuel Thalmann 2024-08-07 23:18:44 +02:00
parent e9be3db64e
commit ec5ccfba2d

View file

@ -83,7 +83,7 @@ $null = New-Module {
}
if ($Category) {
$profiles = $profiles | ForEach-Object { Join-Path (Split-Path -Parent $_) "conf.d" "$Category.ps1" };
$profiles = @($profiles | ForEach-Object { Join-Path (Split-Path -Parent $_) "conf.d" "$Category.ps1" });
}
$profiles | ForEach-Object {
@ -102,4 +102,20 @@ $null = New-Module {
-Script $Script;
};
}
<#
.SYNOPSIS
Creates an eval-script using the `[scriptblock]::Create` method.
.PARAMETER Initializer
The code to evaluate.
#>
function Get-ScriptInitializer {
param (
[Parameter(Position=0, Mandatory=$true)]
$Initializer
)
return ". ([scriptblock]::Create(($Initializer) -join `"``n`"))";
}
};