Allow installing modules native only

This commit is contained in:
Manuel Thalmann 2024-08-08 02:28:23 +02:00
parent d0aed26865
commit a8929f0707

View file

@ -12,12 +12,14 @@ $null = New-Module {
#>
function Get-ModuleInstallerComponents {
param(
[string] $Name
[string] $Name,
[switch] $NativeOnly
)
@{
arguments = @{
name = $Name;
nativeOnly = $NativeOnly;
};
installer = {
param(
@ -27,7 +29,10 @@ $null = New-Module {
$env:PENDING_MODULE_NAME = $Arguments.Name;
$installAction = { Install-Module -Scope AllUsers -Force $env:PENDING_MODULE_NAME @args };
& $installAction -AcceptLicense;
if (-not $Arguments.NativeOnly) {
& $installAction -AcceptLicense;
}
if (Test-Command powershell) {
powershell -c ($installAction.ToString());