1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2024-09-19 10:50:24 -04:00

nix flake show: Only print up to the first new line if it exists.

This commit is contained in:
Jeremy Kolb 2024-07-08 11:56:41 -04:00
parent 547e808a75
commit 07d0527c0c

View file

@ -1262,7 +1262,11 @@ struct CmdFlakeShow : FlakeCommand, MixJSON
attrPath.size() >= 1 && attrPathS[0] == "hydraJobs" ? "derivation" :
"package";
if (description) {
logger->cout("%s: %s '%s' - '%s'", headerPrefix, type, name, *description);
// Handle new lines in descriptions.
auto index = description->find('\n');
std::string_view sanitized_description(description->data(), index != std::string::npos ? index : description->size());
logger->cout("%s: %s '%s' - '%s'", headerPrefix, type, name, sanitized_description);
}
else {
logger->cout("%s: %s '%s'", headerPrefix, type, name);