mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-06-02 04:50:49 +00:00
Change 'vertical' argument to a more generic 'layout', fix api
This commit is contained in:
+11
-9
@@ -7,7 +7,7 @@ import (
|
||||
)
|
||||
|
||||
// BuildGraph generates graph contents from aptly object database
|
||||
func BuildGraph(collectionFactory *CollectionFactory, vertical bool) (gographviz.Interface, error) {
|
||||
func BuildGraph(collectionFactory *CollectionFactory, layout string) (gographviz.Interface, error) {
|
||||
var err error
|
||||
|
||||
graph := gographviz.NewEscape()
|
||||
@@ -17,14 +17,16 @@ func BuildGraph(collectionFactory *CollectionFactory, vertical bool) (gographviz
|
||||
var labelStart string
|
||||
var labelEnd string
|
||||
|
||||
if vertical {
|
||||
graph.AddAttr("aptly", "rankdir", "LR")
|
||||
labelStart = ""
|
||||
labelEnd = ""
|
||||
} else {
|
||||
graph.AddAttr("aptly", "rankdir", "TB")
|
||||
labelStart = "{"
|
||||
labelEnd = "}"
|
||||
switch layout {
|
||||
case "vertical":
|
||||
graph.AddAttr("aptly", "rankdir", "LR")
|
||||
labelStart = ""
|
||||
labelEnd = ""
|
||||
case "horizontal":
|
||||
fallthrough
|
||||
default:
|
||||
labelStart = "{"
|
||||
labelEnd = "}"
|
||||
}
|
||||
|
||||
existingNodes := map[string]bool{}
|
||||
|
||||
Reference in New Issue
Block a user