arrfor"
This commit is contained in:
20
graph.ce
20
graph.ce
@@ -112,11 +112,11 @@ var roots = []
|
||||
if (show_world) {
|
||||
// Use all packages in shop as roots
|
||||
var packages = shop.list_packages()
|
||||
for (var p of packages) {
|
||||
arrfor(packages, function(p) {
|
||||
if (p != 'core') {
|
||||
roots.push(p)
|
||||
}
|
||||
}
|
||||
})
|
||||
} else {
|
||||
// Default to current directory
|
||||
if (!target_locator) {
|
||||
@@ -134,9 +134,9 @@ if (show_world) {
|
||||
roots.push(target_locator)
|
||||
}
|
||||
|
||||
for (var root of roots) {
|
||||
arrfor(roots, function(root) {
|
||||
gather_graph(root, {})
|
||||
}
|
||||
})
|
||||
|
||||
// Output based on format
|
||||
if (format == 'tree') {
|
||||
@@ -157,11 +157,11 @@ if (format == 'tree') {
|
||||
|
||||
// Get children
|
||||
var children = []
|
||||
for (var e of edges) {
|
||||
arrfor(edges, function(e) {
|
||||
if (e.from == locator) {
|
||||
children.push(e)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
for (var i = 0; i < children.length; i++) {
|
||||
var child_prefix = prefix + (is_last ? " " : "| ")
|
||||
@@ -173,11 +173,11 @@ if (format == 'tree') {
|
||||
log.console(roots[i])
|
||||
|
||||
var children = []
|
||||
for (var e of edges) {
|
||||
arrfor(edges, function(e) {
|
||||
if (e.from == roots[i]) {
|
||||
children.push(e)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
for (var j = 0; j < children.length; j++) {
|
||||
print_tree(children[j].to, "", j == children.length - 1, {})
|
||||
@@ -209,12 +209,12 @@ if (format == 'tree') {
|
||||
log.console("")
|
||||
|
||||
// Edges
|
||||
for (var e of edges) {
|
||||
arrfor(edges, function(e) {
|
||||
var from_id = replace(e.from, /[^a-zA-Z0-9]/g, '_')
|
||||
var to_id = replace(e.to, /[^a-zA-Z0-9]/g, '_')
|
||||
var label = e.alias != e.to ? 'label="' + e.alias + '"' : ''
|
||||
log.console(' ' + from_id + ' -> ' + to_id + (label ? ' [' + label + ']' : '') + ';')
|
||||
}
|
||||
})
|
||||
|
||||
log.console("}")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user