aboutsummaryrefslogtreecommitdiff
path: root/src/nix/installables.cc
diff options
context:
space:
mode:
authorregnat <rg@regnat.ovh>2020-10-09 09:39:51 +0200
committerregnat <rg@regnat.ovh>2020-10-09 09:39:51 +0200
commit04e5d0e7040fdfbbc084634c0694ae7da89765d9 (patch)
tree23942b5586c03d62322989a88178237e104da00a /src/nix/installables.cc
parent58dadf295499588e492dab6bdc5934dc27ad3e64 (diff)
Add a description in the completion outputs
Make nix output completions in the form `completion\tdescription`. This can't be used by bash (afaik), but other shells like zsh or fish can display it along the completion choices
Diffstat (limited to 'src/nix/installables.cc')
-rw-r--r--src/nix/installables.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/nix/installables.cc b/src/nix/installables.cc
index 9bf6b7caa..7473c9758 100644
--- a/src/nix/installables.cc
+++ b/src/nix/installables.cc
@@ -26,7 +26,7 @@ void completeFlakeInputPath(
auto flake = flake::getFlake(*evalState, flakeRef, true);
for (auto & input : flake.inputs)
if (hasPrefix(input.first, prefix))
- completions->insert(input.first);
+ completions->add(input.first);
}
MixFlakeOptions::MixFlakeOptions()
@@ -211,7 +211,7 @@ void completeFlakeRefWithFragment(
auto attrPath2 = attr->getAttrPath(attr2);
/* Strip the attrpath prefix. */
attrPath2.erase(attrPath2.begin(), attrPath2.begin() + attrPathPrefix.size());
- completions->insert(flakeRefS + "#" + concatStringsSep(".", attrPath2));
+ completions->add(flakeRefS + "#" + concatStringsSep(".", attrPath2));
}
}
}
@@ -222,7 +222,7 @@ void completeFlakeRefWithFragment(
for (auto & attrPath : defaultFlakeAttrPaths) {
auto attr = root->findAlongAttrPath(parseAttrPath(*evalState, attrPath));
if (!attr) continue;
- completions->insert(flakeRefS + "#");
+ completions->add(flakeRefS + "#");
}
}
}
@@ -243,7 +243,7 @@ ref<EvalState> EvalCommand::getEvalState()
void completeFlakeRef(ref<Store> store, std::string_view prefix)
{
if (prefix == "")
- completions->insert(".");
+ completions->add(".");
completeDir(0, prefix);
@@ -254,10 +254,10 @@ void completeFlakeRef(ref<Store> store, std::string_view prefix)
if (!hasPrefix(prefix, "flake:") && hasPrefix(from, "flake:")) {
std::string from2(from, 6);
if (hasPrefix(from2, prefix))
- completions->insert(from2);
+ completions->add(from2);
} else {
if (hasPrefix(from, prefix))
- completions->insert(from);
+ completions->add(from);
}
}
}