Add shell completion for --override-flake

Requires moving the MixEvalArgs class from libexpr to libcmd because
that's where completeFlakeRef is.
This commit is contained in:
Naïm Favier 2022-02-19 16:59:52 +01:00
parent 55c6906701
commit da7d8daa77
No known key found for this signature in database
GPG key ID: 49B07322580B7EE2
2 changed files with 4 additions and 0 deletions

View file

@ -7,6 +7,7 @@
#include "registry.hh"
#include "flake/flakeref.hh"
#include "store-api.hh"
#include "command.hh"
namespace nix {
@ -59,6 +60,9 @@ MixEvalArgs::MixEvalArgs()
fetchers::Attrs extraAttrs;
if (to.subdir != "") extraAttrs["dir"] = to.subdir;
fetchers::overrideRegistry(from.input, to.input, extraAttrs);
}},
.completer = {[&](size_t, std::string_view prefix) {
completeFlakeRef(openStore(), prefix);
}}
});