PSGraph icon indicating copy to clipboard operation
PSGraph copied to clipboard

SubGraph Example from help doesn't work

Open Stephanevg opened this issue 7 years ago • 1 comments

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 avatar May 20 '18 09:05 Stephanevg

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

Stephanevg avatar May 20 '18 09:05 Stephanevg