aboutsummaryrefslogtreecommitdiff
path: root/src/libcmd/command.hh
diff options
context:
space:
mode:
authorNaïm Favier <n@monade.li>2022-06-20 04:15:38 +0200
committerNaïm Favier <n@monade.li>2022-07-11 15:13:51 +0200
commit711b2e1f48316d80853635408c518e3562a1fa37 (patch)
treedcb298bf9a252344e8e7dd947a5d029e4e6e131d /src/libcmd/command.hh
parentd6d0e781bbade76f6ea3f310cb36973f4013826d (diff)
Fix flake input completion for `InstallablesCommand`s
Defers completion of flake inputs until the whole command line is parsed so that we know what flakes we need to complete the inputs of. Previously, `nix build flake --update-input <Tab>` always behaved like `nix build . --update-input <Tab>`.
Diffstat (limited to 'src/libcmd/command.hh')
-rw-r--r--src/libcmd/command.hh4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/libcmd/command.hh b/src/libcmd/command.hh
index cab379b84..ffa8e784f 100644
--- a/src/libcmd/command.hh
+++ b/src/libcmd/command.hh
@@ -77,12 +77,16 @@ struct MixFlakeOptions : virtual Args, EvalCommand
{
flake::LockFlags lockFlags;
+ std::optional<std::string> needsFlakeInputCompletion = {};
+
MixFlakeOptions();
virtual std::vector<std::string> getFlakesForCompletion()
{ return {}; }
void completeFlakeInput(std::string_view prefix);
+
+ void completionHook() override;
};
struct SourceExprCommand : virtual Args, MixFlakeOptions