mirror of
https://github.com/NixOS/nix
synced 2025-06-26 20:01:15 +02:00
Complete flake inputs for all given flakes
Allow `nix build flake1 flake2 --update-input <Tab>` to complete the inputs of both flakes. Also do tilde expansion so that `nix build ~/flake --update-input <Tab>` works.
This commit is contained in:
parent
7e301fd74e
commit
d6d0e781bb
3 changed files with 24 additions and 24 deletions
|
@ -79,8 +79,10 @@ struct MixFlakeOptions : virtual Args, EvalCommand
|
|||
|
||||
MixFlakeOptions();
|
||||
|
||||
virtual std::optional<FlakeRef> getFlakeRefForCompletion()
|
||||
virtual std::vector<std::string> getFlakesForCompletion()
|
||||
{ return {}; }
|
||||
|
||||
void completeFlakeInput(std::string_view prefix);
|
||||
};
|
||||
|
||||
struct SourceExprCommand : virtual Args, MixFlakeOptions
|
||||
|
@ -119,7 +121,7 @@ struct InstallablesCommand : virtual Args, SourceExprCommand
|
|||
|
||||
virtual bool useDefaultInstallables() { return true; }
|
||||
|
||||
std::optional<FlakeRef> getFlakeRefForCompletion() override;
|
||||
std::vector<std::string> getFlakesForCompletion() override;
|
||||
|
||||
private:
|
||||
|
||||
|
@ -135,9 +137,9 @@ struct InstallableCommand : virtual Args, SourceExprCommand
|
|||
|
||||
void prepare() override;
|
||||
|
||||
std::optional<FlakeRef> getFlakeRefForCompletion() override
|
||||
std::vector<std::string> getFlakesForCompletion() override
|
||||
{
|
||||
return parseFlakeRefWithFragment(_installable, absPath(".")).first;
|
||||
return {_installable};
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue