even more packages

This commit is contained in:
2026-02-19 18:34:17 +01:00
parent e9b5a0084c
commit 38c3ec542b
21 changed files with 205 additions and 14 deletions

View File

@@ -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";