mirror of
https://github.com/NixOS/nix
synced 2025-06-24 22:11:15 +02:00
Merge 73910d39d1
into 6a74590063
This commit is contained in:
commit
679996c9c4
1 changed files with 28 additions and 11 deletions
|
@ -1206,10 +1206,15 @@ struct CmdFlakeShow : FlakeCommand, MixJSON
|
||||||
|| attrPathS[0] == "legacyPackages"
|
|| attrPathS[0] == "legacyPackages"
|
||||||
|| attrPathS[0] == "packages")
|
|| attrPathS[0] == "packages")
|
||||||
&& (attrPathS.size() == 1 || attrPathS.size() == 2)) {
|
&& (attrPathS.size() == 1 || attrPathS.size() == 2)) {
|
||||||
for (const auto &subAttr : visitor2->getAttrs()) {
|
try {
|
||||||
if (hasContent(*visitor2, attrPath2, subAttr)) {
|
for (const auto &subAttr : visitor2->getAttrs()) {
|
||||||
return true;
|
if (hasContent(*visitor2, attrPath2, subAttr)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} catch (IFDError & e) {
|
||||||
|
// allow IFD errors here; as we handle them during `visit()`
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1220,10 +1225,14 @@ struct CmdFlakeShow : FlakeCommand, MixJSON
|
||||||
|| attrPathS[0] == "nixosModules"
|
|| attrPathS[0] == "nixosModules"
|
||||||
|| attrPathS[0] == "overlays"
|
|| attrPathS[0] == "overlays"
|
||||||
)) {
|
)) {
|
||||||
for (const auto &subAttr : visitor2->getAttrs()) {
|
try {
|
||||||
if (hasContent(*visitor2, attrPath2, subAttr)) {
|
for (const auto &subAttr : visitor2->getAttrs()) {
|
||||||
return true;
|
if (hasContent(*visitor2, attrPath2, subAttr)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} catch (IFDError & e) {
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1261,12 +1270,20 @@ struct CmdFlakeShow : FlakeCommand, MixJSON
|
||||||
try {
|
try {
|
||||||
auto recurse = [&]()
|
auto recurse = [&]()
|
||||||
{
|
{
|
||||||
if (!json)
|
|
||||||
logger->cout("%s", headerPrefix);
|
|
||||||
std::vector<Symbol> attrs;
|
std::vector<Symbol> attrs;
|
||||||
for (const auto &attr : visitor.getAttrs()) {
|
try {
|
||||||
if (hasContent(visitor, attrPath, attr))
|
for (const auto &attr : visitor.getAttrs()) {
|
||||||
attrs.push_back(attr);
|
if (hasContent(visitor, attrPath, attr))
|
||||||
|
attrs.push_back(attr);
|
||||||
|
}
|
||||||
|
if (!json)
|
||||||
|
logger->cout("%s", headerPrefix);
|
||||||
|
} catch (IFDError & e) {
|
||||||
|
if (!json) {
|
||||||
|
logger->cout(fmt("%s " ANSI_WARNING "omitted due to use of import from derivation" ANSI_NORMAL, headerPrefix));
|
||||||
|
} else {
|
||||||
|
logger->warn(fmt("%s omitted due to use of import from derivation", concatStringsSep(".", attrPathS)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const auto & [i, attr] : enumerate(attrs)) {
|
for (const auto & [i, attr] : enumerate(attrs)) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue