Stephanevg / PSClassUtils

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

RFC 001: Add feature Display Abastract syntax tree #67

Open Stephanevg opened 5 years ago

Stephanevg commented 5 years ago

Consider creating an abastract syntax tree visulisation for scripts:

Ideally, I would imagine a command having the following syntax:

Write-CUAbastractSyntaxTree -Path * -ExportPath 

-Path: should be capable of handeling FileInfo, FolderInfo, and strings as inputs (just like Write-CUClassDiagram),

-ExportPath: Should default to the current directory. If no name is specified, it should be 'ScriptName.AbastractSyntaxTree.png'

By default, it should create one image per script file (to avoid a clustered image).

some information on AST: https://geekeefy.wordpress.com/2017/06/07/powershell-tokenization-and-abstract-syntax-tree/

PeterMTaylor commented 5 years ago

Good idea! If the recursive option was used that is reading a directory of scripts, be better to display one image per file script otherwise gets clustered and too hard to see.

Stephanevg commented 5 years ago

Great @PeterMTaylor Thanks for pointing that out, I have updated the first section. I am thinking that we could perhaps add a switch parameter to give the possibility to the user to set everything in one and single file. I was thinking of something along the lines of: -Combine or -GenenrateOutputInSingleFile Is that something that would make sense?

PeterMTaylor commented 5 years ago

Ah reflecting this further I think y thoughts would be a simple named switch like -OutputType All for allowing any file even recursively or -OutputType Single to easier to read image per file.

Stephanevg commented 5 years ago

@PeterMTaylor What do you think of:

-OutputType [Combined/Single]

Ps: I am also thinking that this switch could be used for a regular Class (UML) diagram --> Created a new issue to support it here : https://github.com/Stephanevg/PSClassUtils/issues/69

?

PeterMTaylor commented 5 years ago

Sounds good. Go for it! Merry Xmas too!