Skip to content

dfinke/PSClassUtils

 
 

Repository files navigation

PSClassUtils

This module contains tools to ease the work with Powershell Classes.

The most usefull feature is probably the one that it can generate UML Class Diagrams in png format of your scripts / modules. (See Write-ClassDiagram)

Functions currently available:

Write-ClassDiagram
Get-ClassConstructors
Get-ClassMethods
Get-ClassProperties

Write-ClassDiagram

Allows to generate UML diagrams of powerShell scripts / modules that contain PowerShell classes.

This module has a dependency on Kevin Marquette's PSGraph powershell module.

Functionality

It currently support the following features:

  • Document Class
    • Properties
    • Methods
    • Constructors
  • Inheritance

Examples

A script called inheritance.ps1 contains the following code:

Class Woop {
    [String]$String
    [int]$number

    Woop([String]$String,[int]$Number){

    }

    [String]DoSomething(){
        return $this.String
    }
}

Class Wap :Woop {
    [String]$prop3

    DoChildthing(){}

}

Class Wep : Woop {
    [String]$prop4

    DoOtherChildThing(){

    }
}

Calling Write-ClassDiagram

.\Write-ClassDiagram.ps1 -Path ".\Inheritance.ps1"

Results

example with inheritance

Live examples from existing modules on the internet:

I took the 'liberty' to run Write-ClassDiagram on some well known modules available on the internet that are classed based. These are all great modules, and I recommend you have a look at them!

Class.HostsManagement

Below is the export of the Class Diagram of a module I wrote that helps to manage HostsFiles accross the network using PowerShell classes. (The project is accessible Here)

Class.HostsManagement

Get-ClassConstructors

Coming soon...

Get-ClassProperties

Coming soon...

Get-ClassMethods

Coming soon...

Releases

No releases published

Packages

No packages published

Languages

  • PowerShell 100.0%