Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Edge cmdlet case insensitive #68

Closed
Stephanevg opened this issue Jun 23, 2018 · 2 comments
Closed

Make Edge cmdlet case insensitive #68

Stephanevg opened this issue Jun 23, 2018 · 2 comments

Comments

@Stephanevg
Copy link
Contributor

Hi Kevin,

I have something that bothers me on the 'edge' cmdlet. I don't know if this is by design, but I noticed that the 'edge' cmdlet is case sensitive. I would rather have it be insensitive, and most of the things in PowerShell are case insensitive.

See the example below:

graph g {

    SubGraph MyTests {

        Record -Name "Parent" {
            Row "Parent First Row" -Name "Parent_Row_First"
            Row "Parent second Row" -Name "Parent_Row_Second"
            
        }

        $Childs = @("Pierre","Paul","Jacques")

        Foreach($c in $Childs){
            Record -Name $c {
                Row "$c First Row" -Name "$($c)_Row_First"
                Row "$c second Row" -Name "$($c)_Row_Second"
                Row "$c thrid Row" -Name "$($c)_Row_third"
                
            }
        }

    }

    #This will not work, and create a new circle instead of the existing elements of the graph.
    #This is due to the fact that the case is different then in the $Childs array.
        edge -From "parent" -To "pierre","paul","jacques"
    

    
} |Show-PSGraph

This is the result we would get (But not the one we would expect / want):

edge_debbuging_nok

graph g {

    SubGraph MyTests {

        Record -Name "Parent" {
            Row "Parent First Row" -Name "Parent_Row_First"
            Row "Parent second Row" -Name "Parent_Row_Second"
            
        }

        $Childs = @("Pierre","Paul","Jacques")

        Foreach($c in $Childs){
            Record -Name $c {
                Row "$c First Row" -Name "$($c)_Row_First"
                Row "$c second Row" -Name "$($c)_Row_Second"
                Row "$c thrid Row" -Name "$($c)_Row_third"
                
            }
        }

    }

    #This works, since it has the EXACT same case sensitivy a the strings located in '$Childs'
        edge -From "Parent" -To "Pierre","Paul","Jacques"


} |Show-PSGraph

And in this case, this is what we would get (and actually expect).

edge_debbuging_ok

Although the fix seems trivial, I needed quite some time to realize where it came from, as I was testing it on various scripts with Write-ClassDiagram on scripts that I didn't write. (See issue on PowershellClassUtils here)

I think it would be great if we could remove the case sensitivity, as I don't really see, as a PowerShell scripter, what it actually brings as added value.

@Stephanevg Stephanevg changed the title Edge cmdlet is case insensitive Make Edge cmdlet case insensitive Jun 28, 2018
@KevinMarquette
Copy link
Owner

It's actually graphviz that is case sensitive. I do provide a way to set a custom node name format script that can provide case insensitivity.

Set-NodeFormatScript -ScriptBlock {$_.ToLower()}

This will have the side effect of making all node names lowercase. I often counter that by specifying a label on my nodes so they display as expected.

@Stephanevg
Copy link
Contributor Author

Hi,

I actually provided an -IgnoreCase in my function, which will force the name of the nodes to TitleCase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants