Skip to content

Commit

Permalink
Issue Fixing
Browse files Browse the repository at this point in the history
Fixing issue Stephanevg#104
Fixing issue Stephanevg#103
Add Pipeline support for Get-CUEnum Stephanevg#102
  • Loading branch information
LxLeChat committed Apr 20, 2019
1 parent a097c49 commit ff6bf21
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 26 deletions.
20 changes: 10 additions & 10 deletions Code/Functions/Public/Get-CUClass.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -103,23 +103,23 @@ function Get-CUClass {
} Else {

Foreach ( $x in (Get-CULoadedClass @ClassParams ) ) {

If ( $PSBoundParameters['ClassName'] ) {
If ( $x.name -eq $PSBoundParameters['ClassName'] ) {
If ( !$x.IsEnum ){
If ( $PSBoundParameters['ClassName'] ) {
If ( $x.name -eq $PSBoundParameters['ClassName'] ) {
If ( $PSBoundParameters['Raw'] ) {
([CUClass]::New($x)).Raw
} Else {
[CUClass]::New($x)
}
}
} Else {
If ( $PSBoundParameters['Raw'] ) {
([CUClass]::New($x)).Raw
} Else {
[CUClass]::New($x)
}
}
} Else {
If ( $PSBoundParameters['Raw'] ) {
([CUClass]::New($x)).Raw
} Else {
[CUClass]::New($x)
}
}

}
}
}
Expand Down
38 changes: 22 additions & 16 deletions Code/Functions/Public/Get-CUEnum.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -26,32 +26,38 @@ Function Get-CUEnum{
#>
[cmdletBinding()]
Param(

[Parameter(Mandatory=$false,ValueFromPipeline=$true)]
[String[]]
$Path = (throw "Please provide a path")
[Alias("FullName")]
[Parameter(ValueFromPipeline=$True,Position=1,ValueFromPipelineByPropertyName=$True)]
[string[]]$Path
)

begin{

}
Process{

foreach($p in $Path){

$AST = Get-cuast -Path $p | ? {$_.IsEnum -eq $True}

foreach($enum in $AST){
[ClassEnum]::New($enum.Name,$enum.members.Name)
Process{
ForEach( $p in $Path) {
Write-Verbose "ICI"
$item = get-item (resolve-path -path $p).path
If ( $item -is [system.io.FileInfo] -and $item.Extension -in @('.ps1','.psm1') ) {
Write-Verbose "[Get-CUEnum][Path] $($item.FullName)"
$AST = Get-cuast -Path $item.FullName | Where-Object IsEnum

foreach($enum in $AST){
[ClassEnum]::New($enum.Name,$enum.members.Name)
}
}
}


If ( $null -eq $PSBoundParameters['Path']) {
Foreach ( $Enum in (Get-CULoadedClass ) ) {
If($Enum.IsEnum){
[ClassEnum]::New($Enum.Name,$Enum.members.Name)
}
}
}
}
End{

}
}



}

0 comments on commit ff6bf21

Please sign in to comment.