Skip to content
Permalink
Browse files

added gropup parameter

  • Loading branch information
Rob.Sewell Rob.Sewell
Rob.Sewell authored and Rob.Sewell committed Nov 26, 2019
1 parent 0028a54 commit 73d39f8212d9b89a9d5c0527b7a0e93fdac21a18
Showing with 13 additions and 8 deletions.
  1. +13 −8 functions/Get-DbcCheck.ps1
@@ -8,6 +8,9 @@
.PARAMETER Pattern
May be any string, supports wildcards.
.PARAMETER Group
To be able to filter by group
.PARAMETER EnableException
By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.
This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables advanced scripting.
@@ -30,6 +33,7 @@ function Get-DbcCheck {
[CmdletBinding()]
param (
[string]$Pattern,
[string]$Group,
[switch]$EnableException
)

@@ -42,9 +46,6 @@ function Get-DbcCheck {
$_.Group -match $Pattern -or $_.Description -match $Pattern -or
$_.UniqueTag -match $Pattern -or $_.AllTags -match $Pattern -or $_.Type -match $Pattern
}
@($output).ForEach{
Select-DefaultView -InputObject $psitem -TypeName Check -Property 'Group', 'Type', 'UniqueTag', 'AllTags', 'Config', 'Description'
}
}
}
else {
@@ -53,18 +54,22 @@ function Get-DbcCheck {
$_.Group -like $Pattern -or $_.Description -like $Pattern -or
$_.UniqueTag -like $Pattern -or $_.AllTags -like $Pattern -or $_.Type -like $Pattern
}
@($output).ForEach{
Select-DefaultView -InputObject $psitem -TypeName Check -Property 'Group', 'Type', 'UniqueTag', 'AllTags' , 'Config', 'Description'
}
}
}
}
else {
$output = Get-Content "$script:localapp\checks.json" | Out-String | ConvertFrom-Json
@($output).ForEach{
Select-DefaultView -InputObject $psitem -TypeName Check -Property 'Group', 'Type', 'UniqueTag', 'AllTags', 'Config', 'Description'
}
if ($Group) {
$output = @($output).ForEach{
$psitem | Where-Object {
$_.Group -eq $Group
}
}
}
@($output).ForEach{
Select-DefaultView -InputObject $psitem -TypeName Check -Property 'Group', 'Type', 'UniqueTag', 'AllTags', 'Config', 'Description'
}
}
}
# SIG # Begin signature block

0 comments on commit 73d39f8

Please sign in to comment.
You can’t perform that action at this time.