mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-14 02:06:16 +02:00
Merge pull request #3009 from codedownio/add-pname-and-version-to-json
Add pname and version to nix-env -q --json
This commit is contained in:
commit
41d010fff6
1 changed files with 11 additions and 4 deletions
|
@ -860,7 +860,10 @@ static void queryJSON(Globals & globals, vector<DrvInfo> & elems)
|
||||||
for (auto & i : elems) {
|
for (auto & i : elems) {
|
||||||
JSONObject pkgObj = topObj.object(i.attrPath);
|
JSONObject pkgObj = topObj.object(i.attrPath);
|
||||||
|
|
||||||
pkgObj.attr("name", i.queryName());
|
auto drvName = DrvName(i.queryName());
|
||||||
|
pkgObj.attr("name", drvName.fullName);
|
||||||
|
pkgObj.attr("pname", drvName.name);
|
||||||
|
pkgObj.attr("version", drvName.version);
|
||||||
pkgObj.attr("system", i.querySystem());
|
pkgObj.attr("system", i.querySystem());
|
||||||
|
|
||||||
JSONObject metaObj = pkgObj.object("meta");
|
JSONObject metaObj = pkgObj.object("meta");
|
||||||
|
@ -1026,10 +1029,14 @@ static void opQuery(Globals & globals, Strings opFlags, Strings opArgs)
|
||||||
else if (printAttrPath)
|
else if (printAttrPath)
|
||||||
columns.push_back(i.attrPath);
|
columns.push_back(i.attrPath);
|
||||||
|
|
||||||
if (xmlOutput)
|
if (xmlOutput) {
|
||||||
attrs["name"] = i.queryName();
|
auto drvName = DrvName(i.queryName());
|
||||||
else if (printName)
|
attrs["name"] = drvName.fullName;
|
||||||
|
attrs["pname"] = drvName.name;
|
||||||
|
attrs["version"] = drvName.version;
|
||||||
|
} else if (printName) {
|
||||||
columns.push_back(i.queryName());
|
columns.push_back(i.queryName());
|
||||||
|
}
|
||||||
|
|
||||||
if (compareVersions) {
|
if (compareVersions) {
|
||||||
/* Compare this element against the versions of the
|
/* Compare this element against the versions of the
|
||||||
|
|
Loading…
Reference in a new issue