diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2007-05-01T11·30+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2007-05-01T11·30+0000 |
commit | bd1f66453a7a1900f9fa850a7052b3fbe3e26933 (patch) | |
tree | 1cb7c1c392f61fd6fecb1b84d87df2bd4c782fd8 /src/nix-env/nix-env.cc | |
parent | e20f0da22ccb28d94bfd82fa66e2a723c75951f2 (diff) |
* `nix-env -q --xml --meta' to show all meta attributes.
Diffstat (limited to 'src/nix-env/nix-env.cc')
-rw-r--r-- | src/nix-env/nix-env.cc | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/nix-env/nix-env.cc b/src/nix-env/nix-env.cc index 3eea5c0c55e4..9f965bd2872f 100644 --- a/src/nix-env/nix-env.cc +++ b/src/nix-env/nix-env.cc @@ -836,6 +836,7 @@ static void opQuery(Globals & globals, bool printDrvPath = false; bool printOutPath = false; bool printDescription = false; + bool printMeta = false; bool prebuiltOnly = false; bool compareVersions = false; bool xmlOutput = false; @@ -853,6 +854,7 @@ static void opQuery(Globals & globals, else if (*i == "--compare-versions" || *i == "-c") compareVersions = true; else if (*i == "--drv-path") printDrvPath = true; else if (*i == "--out-path") printOutPath = true; + else if (*i == "--meta") printMeta = true; else if (*i == "--installed") source = sInstalled; else if (*i == "--available" || *i == "-a") source = sAvailable; else if (*i == "--prebuilt-only" || *i == "-b") prebuiltOnly = true; @@ -1014,7 +1016,18 @@ static void opQuery(Globals & globals, } if (xmlOutput) - xml.writeEmptyElement("item", attrs); + if (printMeta) { + XMLOpenElement item(xml, "item", attrs); + MetaInfo meta = i->queryMetaInfo(globals.state); + for (MetaInfo::iterator j = meta.begin(); j != meta.end(); ++j) { + XMLAttrs attrs2; + attrs2["name"] = j->first; + attrs2["value"] = j->second; + xml.writeEmptyElement("meta", attrs2); + } + } + else + xml.writeEmptyElement("item", attrs); else table.push_back(columns); |