nix search: Show version

This commit is contained in:
Eelco Dolstra 2020-04-24 14:42:17 +02:00
parent ef4d3fc111
commit 0469795978

View file

@ -142,17 +142,16 @@ struct CmdSearch : InstallableCommand, MixJSON
results++; results++;
if (json) { if (json) {
auto jsonElem = jsonOut->object(attrPath2); auto jsonElem = jsonOut->object(attrPath2);
jsonElem.attr("pkgName", name.name); jsonElem.attr("pname", name.name);
jsonElem.attr("version", name.version); jsonElem.attr("version", name.version);
jsonElem.attr("description", description); jsonElem.attr("description", description);
} else { } else {
auto name2 = hilite(name.name, nameMatch, "\e[0;2m") auto name2 = hilite(name.name, nameMatch, "\e[0;2m");
+ std::string(name.fullName, name.name.length());
if (results > 1) logger->stdout(""); if (results > 1) logger->stdout("");
logger->stdout( logger->stdout(
"* %s (%s)", "* %s%s",
wrap("\e[0;1m", hilite(attrPath2, attrPathMatch, "\e[0;1m")), wrap("\e[0;1m", hilite(attrPath2, attrPathMatch, "\e[0;1m")),
wrap("\e[0;2m", hilite(name2, nameMatch, "\e[0;2m"))); name.version != "" ? " (" + name.version + ")" : "");
if (description != "") if (description != "")
logger->stdout( logger->stdout(
" %s", hilite(description, descriptionMatch, ANSI_NORMAL)); " %s", hilite(description, descriptionMatch, ANSI_NORMAL));