Updated MyPackage code

Better handling of package creation/modification via Set-MyPackage
Update the szCondition class to include CmdletExists+AppExeExists
This commit is contained in:
Gal Szkolnik 2021-05-20 14:15:58 -04:00
parent 23e4c03c92
commit 60825c92c8
2 changed files with 15 additions and 4 deletions

View File

@ -46,10 +46,19 @@ process {
}
switch($Template){
"Default" {
New-Item -Type Directory (Join-Path $pkgPath 'profile.d')
New-Item -Type Directory (Join-Path $pkgPath 'Aliases')
New-Item -Type Directory (Join-Path $pkgPath 'src')
New-Item -Type File -Path (Join-Path (Join-Path $pkgPath 'profile.d') 'env.local.ps1') -Value ''
function SafeMk{param([string]$Path,[string]$PathType="Directory")
if( Test-Path $Path ) { return }
$local:newItemParam = @{
Type = $PathType
Path = $Path
}
if( $PathType -eq 'File' ) { $newItemParam.Value = '' }
New-Item -Type $PathType $Path
}
SafeMk (Join-Path $pkgPath 'profile.d')
SafeMk (Join-Path $pkgPath 'Aliases')
SafeMk (Join-Path $pkgPath 'src')
SafeMk -PathType 'File' (Join-Path (Join-Path $pkgPath 'profile.d') 'env.local.ps1')
}
}
$jsonPath = Join-Path $pkgPath '_.package.json'

View File

@ -91,6 +91,8 @@ class szCondition {
[string[]]$System = $null
[string[]]$Hostname = $null
[string[]]$Username = $null
[string[]]$CmdletExists = $null
[string[]]$AppExeExists = $null
[szLogic]$Logic = [szLogic]::and
[string] ToString() {