aboutsummaryrefslogtreecommitdiff
path: root/src/libcmd/installables.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/libcmd/installables.cc')
-rw-r--r--src/libcmd/installables.cc44
1 files changed, 13 insertions, 31 deletions
diff --git a/src/libcmd/installables.cc b/src/libcmd/installables.cc
index 5090ea6d2..f8632a535 100644
--- a/src/libcmd/installables.cc
+++ b/src/libcmd/installables.cc
@@ -696,46 +696,28 @@ InstallableFlake::getCursors(EvalState & state)
std::vector<ref<eval_cache::AttrCursor>> res;
- for (auto & attrPath : getActualAttrPaths()) {
- auto attr = root->findAlongAttrPath(parseAttrPath(state, attrPath));
- if (attr) res.push_back(ref(*attr));
- }
-
- return res;
-}
-
-ref<eval_cache::AttrCursor> InstallableFlake::getCursor(EvalState & state)
-{
- auto lockedFlake = getLockedFlake();
-
- auto cache = openEvalCache(state, lockedFlake);
- auto root = cache->getRoot();
-
Suggestions suggestions;
-
auto attrPaths = getActualAttrPaths();
for (auto & attrPath : attrPaths) {
debug("trying flake output attribute '%s'", attrPath);
- auto attrOrSuggestions = root->findAlongAttrPath(
- parseAttrPath(state, attrPath),
- true
- );
-
- if (!attrOrSuggestions) {
- suggestions += attrOrSuggestions.getSuggestions();
- continue;
+ auto attr = root->findAlongAttrPath(parseAttrPath(state, attrPath));
+ if (attr) {
+ res.push_back(ref(*attr));
+ } else {
+ suggestions += attr.getSuggestions();
}
-
- return *attrOrSuggestions;
}
- throw Error(
- suggestions,
- "flake '%s' does not provide attribute %s",
- flakeRef,
- showAttrPaths(attrPaths));
+ if (res.size() == 0)
+ throw Error(
+ suggestions,
+ "flake '%s' does not provide attribute %s",
+ flakeRef,
+ showAttrPaths(attrPaths));
+
+ return res;
}
std::shared_ptr<flake::LockedFlake> InstallableFlake::getLockedFlake() const