Test-MyModules finalized, ready for work

Future imporvement will allow prompting for installation or a command to
automate following recommendations.
Этот коммит содержится в:
Gal 2020-11-05 00:29:04 -05:00
родитель 0d5522b8c7
Коммит 7dd40b7b82
2 изменённых файлов: 18 добавлений и 1 удалений

18
profile.d/Test-MyModules.ps1 Обычный файл
Просмотреть файл

@ -0,0 +1,18 @@
if( -not $global:MyModulesWarning ) {
$global:MyModulesWarning = @()
}
[MyConfig]::GetConfigPaths('mymodules',$false) |
ForEach-Object {
$( Get-Content $_ | ConvertFrom-Json ).Modules
} | Where-Object {
$local:m = $_
if( $( try {
-not (Get-Module -ListAvailable $m -ErrorAction stop)
} catch { $true }
)) {
$m -notin $global:MyModulesWarning
}
} | ForEach-Object {
$global:MyModulesWarning += $_
Write-Warning "Missing module: $_"
}

Просмотреть файл

@ -1 +0,0 @@
$(Get-Content $MyPSScriptRoot/src/modules.json | ConvertFrom-Json).Modules | Where-Object { try{-not (Get-Module -ListAvailable $_aaa -ErrorAction stop) }catch{} } | ForEach-Object { Write-Warning "Missing module: $_" }