Modify Setup, Path, added Get-MyModules
+ base/Get-MyModules added * base/profile.d/Test-MyModules modified to use Get-MyModules * Setup-Profile modified so that sudo witll preserve environment * Get-Path fixed bug introduced in last commit, Get-Path would fail when file to be edited didn't exist
This commit is contained in:
parent
5dae2a2af5
commit
6d2a23ae04
4 changed files with 41 additions and 25 deletions
|
@ -1,24 +1,12 @@
|
|||
param([switch]$Force)
|
||||
|
||||
$local:currentSys = [SystemName]::_GetValidValues('',$true,$true);
|
||||
|
||||
if( -not $global:MyModulesWarning -or $Force ) {
|
||||
$global:MyModulesWarning = @()
|
||||
}
|
||||
|
||||
[MyConfig]::GetConfigPaths('mymodules',$false) |
|
||||
ForEach-Object {
|
||||
$local:modules = $( Get-Content $_ | ConvertFrom-Json );
|
||||
$modules.Always
|
||||
$currentSys | ForEach-Object { $modules."$_" }
|
||||
} | Where-Object { $_ } | Where-Object {
|
||||
$local:m = $_
|
||||
if( $( try {
|
||||
-not (Get-Module -ListAvailable $m -ErrorAction stop)
|
||||
} catch { $true }
|
||||
)) {
|
||||
$m -notin $global:MyModulesWarning
|
||||
}
|
||||
Get-MyModules -MissingOnly |
|
||||
Where-Object {
|
||||
$_ -notin $global:MyModulesWarning
|
||||
} | ForEach-Object {
|
||||
$global:MyModulesWarning += $_
|
||||
Write-Warning "Missing module: $_"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue