Stephanevg / PSClassUtils

A set of utilities to work with Powershell Classes
http://powershelldistrict.com/how-to-generate-a-uml-diagram-using-powershell/
91 stars 23 forks source link

Get-CUClass list enums as a class. #103

Open Stephanevg opened 5 years ago

Stephanevg commented 5 years ago

Given the following powershell module


Enum ComputerType {
    Server
    Client
}

Class Computer {
    [String]$Name
    [ComputerType]$Type
}

Function Get-InternalStuff {
    #Does internal stuff 
}

Function Get-ComputerData {
    #Does stuff
}

Export-ModuleMember -Function Get-ComputerData 
Import-Module PsClassUtils

Get-CUClass

Name            : ComputerType
Property        : {Server, Client}
Constructor     :
Method          :
IsInherited     : False
ParentClassName :
Path            : C:\Users\taavast3\OneDrive\Repo\Projects\OpenSource\Stephanevg.github.io\_Drafts\plop.psm1

Name            : Computer
Property        : {Name, Type}
Constructor     :
Method          :
IsInherited     : False
ParentClassName :
Path            : C:\Users\taavast3\OneDrive\Repo\Projects\OpenSource\Stephanevg.github.io\_Drafts\plop.psm1

It should not Show the Enum.

LxLeChat commented 5 years ago

An If Block is missing in Get-CUClass You should had the following If statement after the Foreach statement

Foreach ( $x in (Get-CULoadedClass @ClassParams ) ) {
                If ( !$x.IsEnum ){