aboutsummaryrefslogtreecommitdiff
path: root/src/nix/command.hh
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2020-06-08 16:20:00 +0200
committerEelco Dolstra <edolstra@gmail.com>2020-06-08 16:20:00 +0200
commit6470450ab48196668099eeca2f171fec110d647b (patch)
tree8ac719d47c3442f3f5b0b640d8b09b1a22a94c77 /src/nix/command.hh
parent9ef6048d784a298f384affdec941b5b38c61346c (diff)
Add completion for --update-input
Diffstat (limited to 'src/nix/command.hh')
-rw-r--r--src/nix/command.hh14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/nix/command.hh b/src/nix/command.hh
index fe8e40835..a8779b0e6 100644
--- a/src/nix/command.hh
+++ b/src/nix/command.hh
@@ -40,14 +40,17 @@ struct EvalCommand : virtual StoreCommand, MixEvalArgs
std::shared_ptr<EvalState> evalState;
};
-struct MixFlakeOptions : virtual Args
+struct MixFlakeOptions : virtual Args, EvalCommand
{
flake::LockFlags lockFlags;
MixFlakeOptions();
+
+ virtual std::optional<FlakeRef> getFlakeRefForCompletion()
+ { return {}; }
};
-struct SourceExprCommand : virtual Args, EvalCommand, MixFlakeOptions
+struct SourceExprCommand : virtual Args, MixFlakeOptions
{
std::optional<Path> file;
std::optional<std::string> expr;
@@ -81,6 +84,8 @@ struct InstallablesCommand : virtual Args, SourceExprCommand
virtual bool useDefaultInstallables() { return true; }
+ std::optional<FlakeRef> getFlakeRefForCompletion() override;
+
private:
std::vector<std::string> _installables;
@@ -95,6 +100,11 @@ struct InstallableCommand : virtual Args, SourceExprCommand
void prepare() override;
+ std::optional<FlakeRef> getFlakeRefForCompletion() override
+ {
+ return parseFlakeRef(_installable, absPath("."));
+ }
+
private:
std::string _installable{"."};