mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-25 23:36:16 +02:00
Merge pull request #5883 from fzakaria/faridzakaria/check-meta
Check for `--meta` before emitting it for `--json`
This commit is contained in:
commit
d023903b6f
1 changed files with 15 additions and 13 deletions
|
@ -907,7 +907,7 @@ static VersionDiff compareVersionAgainstSet(
|
|||
}
|
||||
|
||||
|
||||
static void queryJSON(Globals & globals, vector<DrvInfo> & elems, bool printOutPath)
|
||||
static void queryJSON(Globals & globals, vector<DrvInfo> & elems, bool printOutPath, bool printMeta)
|
||||
{
|
||||
JSONObject topObj(cout, true);
|
||||
for (auto & i : elems) {
|
||||
|
@ -927,6 +927,7 @@ static void queryJSON(Globals & globals, vector<DrvInfo> & elems, bool printOutP
|
|||
}
|
||||
}
|
||||
|
||||
if (printMeta) {
|
||||
JSONObject metaObj = pkgObj.object("meta");
|
||||
StringSet metaNames = i.queryMetaNames();
|
||||
for (auto & j : metaNames) {
|
||||
|
@ -941,6 +942,7 @@ static void queryJSON(Globals & globals, vector<DrvInfo> & elems, bool printOutP
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1043,7 +1045,7 @@ static void opQuery(Globals & globals, Strings opFlags, Strings opArgs)
|
|||
|
||||
/* Print the desired columns, or XML output. */
|
||||
if (jsonOutput) {
|
||||
queryJSON(globals, elems, printOutPath);
|
||||
queryJSON(globals, elems, printOutPath, printMeta);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue