diff options
author | Tom Bereknyei <tomberek@gmail.com> | 2022-05-13 11:12:11 -0400 |
---|---|---|
committer | Tom Bereknyei <tomberek@gmail.com> | 2022-05-13 11:12:11 -0400 |
commit | 8150b93968c648c6d273aaffaffba94096ec3faf (patch) | |
tree | d3818ccddb1b9b8240a039091260f0946bde0515 /src/nix | |
parent | bf89cd95a4af35ab15f7fad3186c8f6190f87c84 (diff) |
fix: alignment during flake show of legacyPackages
Fixes:
https://github.com/NixOS/nix/issues/6240
https://github.com/NixOS/nix/issues/6045
Diffstat (limited to 'src/nix')
-rw-r--r-- | src/nix/flake.cc | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/nix/flake.cc b/src/nix/flake.cc index 1938ce4e6..f55929751 100644 --- a/src/nix/flake.cc +++ b/src/nix/flake.cc @@ -1076,9 +1076,13 @@ struct CmdFlakeShow : FlakeCommand, MixJSON else if (attrPath.size() > 0 && attrPathS[0] == "legacyPackages") { if (attrPath.size() == 1) recurse(); - else if (!showLegacy) - logger->warn(fmt("%s: " ANSI_WARNING "omitted" ANSI_NORMAL " (use '--legacy' to show)", headerPrefix)); - else { + else if (!showLegacy){ + if (!json) + logger->cout(fmt("%s " ANSI_WARNING "omitted" ANSI_NORMAL " (use '--legacy' to show)", headerPrefix)); + else { + logger->warn(fmt("%s omitted (use '--legacy' to show)", concatStringsSep(".", attrPathS))); + } + } else { if (visitor.isDerivation()) showDerivation(); else if (attrPath.size() <= 2) |