mirror of
https://github.com/NixOS/nix
synced 2025-07-06 13:21:47 +02:00
Add XML output to `nix-store'.
* src/nix-store/Makefile.am (nix_store_SOURCES): Add `xmlgraph.cc' and `xmlgraph.hh'. * src/nix-store/help.txt (Operations): Document `--xml'. * src/nix-store/nix-store.cc (opQuery): Handle `--xml'. * src/nix-store/xmlgraph.cc, src/nix-store/xmlgraph.hh: New files.
This commit is contained in:
parent
da52f8bea0
commit
8bcdd36f10
5 changed files with 100 additions and 3 deletions
|
@ -6,6 +6,7 @@
|
|||
#include "archive.hh"
|
||||
#include "shared.hh"
|
||||
#include "dotgraph.hh"
|
||||
#include "xmlgraph.hh"
|
||||
#include "local-store.hh"
|
||||
#include "util.hh"
|
||||
#include "help.txt.hh"
|
||||
|
@ -226,7 +227,7 @@ static void opQuery(Strings opFlags, Strings opArgs)
|
|||
{
|
||||
enum { qOutputs, qRequisites, qReferences, qReferrers
|
||||
, qReferrersClosure, qDeriver, qBinding, qHash
|
||||
, qTree, qGraph, qResolve, qRoots } query = qOutputs;
|
||||
, qTree, qGraph, qXml, qResolve, qRoots } query = qOutputs;
|
||||
bool useOutput = false;
|
||||
bool includeOutputs = false;
|
||||
bool forceRealise = false;
|
||||
|
@ -249,6 +250,7 @@ static void opQuery(Strings opFlags, Strings opArgs)
|
|||
else if (*i == "--hash") query = qHash;
|
||||
else if (*i == "--tree") query = qTree;
|
||||
else if (*i == "--graph") query = qGraph;
|
||||
else if (*i == "--xml") query = qXml;
|
||||
else if (*i == "--resolve") query = qResolve;
|
||||
else if (*i == "--roots") query = qRoots;
|
||||
else if (*i == "--use-output" || *i == "-u") useOutput = true;
|
||||
|
@ -327,7 +329,15 @@ static void opQuery(Strings opFlags, Strings opArgs)
|
|||
PathSet roots;
|
||||
foreach (Strings::iterator, i, opArgs)
|
||||
roots.insert(maybeUseOutput(followLinksToStorePath(*i), useOutput, forceRealise));
|
||||
printDotGraph(roots);
|
||||
printDotGraph(roots);
|
||||
break;
|
||||
}
|
||||
|
||||
case qXml: {
|
||||
PathSet roots;
|
||||
foreach (Strings::iterator, i, opArgs)
|
||||
roots.insert(maybeUseOutput(followLinksToStorePath(*i), useOutput, forceRealise));
|
||||
printXmlGraph(roots);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue