aboutsummaryrefslogtreecommitdiff
path: root/src/nix/search.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2020-04-24 14:42:17 +0200
committerEelco Dolstra <edolstra@gmail.com>2020-04-24 14:42:17 +0200
commit0469795978599d84bc47226f373e178332fc0aaa (patch)
treead91f6df8f7c067ad19f58d5995cd42667222897 /src/nix/search.cc
parentef4d3fc111c6b6c6f731a1f867c839d4adcf6e8e (diff)
nix search: Show version
Diffstat (limited to 'src/nix/search.cc')
-rw-r--r--src/nix/search.cc9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/nix/search.cc b/src/nix/search.cc
index 9c11af490..586bff5e5 100644
--- a/src/nix/search.cc
+++ b/src/nix/search.cc
@@ -142,17 +142,16 @@ struct CmdSearch : InstallableCommand, MixJSON
results++;
if (json) {
auto jsonElem = jsonOut->object(attrPath2);
- jsonElem.attr("pkgName", name.name);
+ jsonElem.attr("pname", name.name);
jsonElem.attr("version", name.version);
jsonElem.attr("description", description);
} else {
- auto name2 = hilite(name.name, nameMatch, "\e[0;2m")
- + std::string(name.fullName, name.name.length());
+ auto name2 = hilite(name.name, nameMatch, "\e[0;2m");
if (results > 1) logger->stdout("");
logger->stdout(
- "* %s (%s)",
+ "* %s%s",
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 != "")
logger->stdout(
" %s", hilite(description, descriptionMatch, ANSI_NORMAL));