even more packages
This commit is contained in:
21
src/main.cc
21
src/main.cc
@@ -179,20 +179,21 @@ void generate_graph(const std::vector<std::string> &to_highlight) {
|
||||
std::ofstream out("/tmp/shrap/graph.dot");
|
||||
|
||||
out << "digraph dependencies {\n";
|
||||
out << " rankdir=LR;\n";
|
||||
if (to_highlight.empty()) {
|
||||
out << " rankdir=LR;\n";
|
||||
}
|
||||
|
||||
for (const auto &[pkg_name, pkg] : packages) {
|
||||
if (std::find(to_highlight.begin(), to_highlight.end(), pkg_name) !=
|
||||
to_highlight.end()) {
|
||||
out << " \"" << pkg_name << "\" [style=filled, fillcolor=yellow];\n";
|
||||
} else {
|
||||
if (to_highlight.empty() ||
|
||||
std::find(to_highlight.begin(), to_highlight.end(), pkg_name) !=
|
||||
to_highlight.end()) {
|
||||
out << " \"" << pkg_name << "\";\n";
|
||||
}
|
||||
try {
|
||||
for (const auto &dep : pkg.get("dependencies").children) {
|
||||
out << " \"" << pkg_name << "\" -> \"" << dep.value << "\";\n";
|
||||
try {
|
||||
for (const auto &dep : pkg.get("dependencies").children) {
|
||||
out << " \"" << pkg_name << "\" -> \"" << dep.value << "\";\n";
|
||||
}
|
||||
} catch (std::out_of_range &) {
|
||||
}
|
||||
} catch (std::out_of_range &) {
|
||||
}
|
||||
}
|
||||
out << "}\n";
|
||||
|
||||
Reference in New Issue
Block a user