Skip to content

Commit

Permalink
d2: use arrows instead of move
Browse files Browse the repository at this point in the history
  • Loading branch information
vdjagilev committed May 12, 2024
1 parent 4070611 commit 2960940
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions formatter/formatter_d2.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ func (f *D2LangFormatter) Format(td *TemplateData, templateContent string) (err
portID := fmt.Sprintf("%s-port%d", hostID, port.PortID)
graph, _, _ = d2oracle.Create(graph, nil, portID)
portLabel := fmt.Sprintf("%d/%s\n%s\n%s", port.PortID, port.Protocol, port.State.State, port.Service.Name)
graph, _ = d2oracle.Set(graph, nil, portID+".label", nil, &portLabel)
graph, _ = d2oracle.Set(graph, nil, fmt.Sprintf("%s.label", portID), nil, &portLabel)
shape := "circle"
graph, _ = d2oracle.Set(graph, nil, portID+".shape", nil, &shape)
graph, _ = d2oracle.Set(graph, nil, fmt.Sprintf("%s.shape", portID), nil, &shape)
width := "25"
graph, _ = d2oracle.Set(graph, nil, portID+".width", nil, &width)
graph, _ = d2oracle.Move(graph, nil, portID, hostID+"."+portID, true)
graph, _ = d2oracle.Set(graph, nil, fmt.Sprintf("%s.width", portID), nil, &width)
graph, _ = d2oracle.Set(graph, nil, hostID+" -> "+portID, nil, nil)
}
}
_, err = f.config.Writer.Write([]byte(d2format.Format(graph.AST)))
Expand Down

0 comments on commit 2960940

Please sign in to comment.