KevinMarquette / PSGraph

A set of utilities for working with Graphviz in Powershell
MIT License
206 stars 49 forks source link

SubGraph Example from help doesn't work #66

Open Stephanevg opened 6 years ago

Stephanevg commented 6 years ago

Hi,

I was looking into the SubGraph functionality, and noticed that the example in the documentation wasn't working:

graph {
    subgraph -Attributes @{label='DMZ'} {
        node web1,web2,reports
        edge report -To web1,web2
    }        
    edge loadBalancer -To web1,web2
    edge user -To loadBalancer,report
    edge web1,web2,report -To database
} | show-psgraph

this is the the message i get back:

cmdlet SubGraph at command pipeline position 1
Supply values for the following parameters:
ScriptBlock:
Stephanevg commented 6 years ago

Ok, I found the issue:

The positional parameter for the ScriptBlock doesn't seem to work. Using a named parameter solved the issue.

For example, calling the snippet like this, works:

graph {
    subgraph -Attributes @{label='DMZ'} -ScriptBlock {
        node web1,web2,reports
        edge report -To web1,web2
    }        
    edge loadBalancer -To web1,web2
    edge user -To loadBalancer,report
    edge web1,web2,report -To database
} | show-psgraph