diff options
author | Théophane Hufschmitt <7226587+thufschmitt@users.noreply.github.com> | 2022-07-12 09:12:00 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-12 09:12:00 +0200 |
commit | f071eb3702c7aa86fc1885321d73a3707ed702b6 (patch) | |
tree | 6ebb56e21b2f514348971bffd25250e3b1712e86 /src/libcmd/command.hh | |
parent | 7e23039b7f491f8517309e0c20653d6d80c37dd7 (diff) | |
parent | 711b2e1f48316d80853635408c518e3562a1fa37 (diff) |
Merge pull request #6693 from ncfavier/complete-flake-inputs
Improve shell completion of flake inputs
Diffstat (limited to 'src/libcmd/command.hh')
-rw-r--r-- | src/libcmd/command.hh | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/libcmd/command.hh b/src/libcmd/command.hh index 6bd38810b..3b4b40981 100644 --- a/src/libcmd/command.hh +++ b/src/libcmd/command.hh @@ -78,10 +78,16 @@ struct MixFlakeOptions : virtual Args, EvalCommand { flake::LockFlags lockFlags; + std::optional<std::string> needsFlakeInputCompletion = {}; + MixFlakeOptions(); - virtual std::optional<FlakeRef> getFlakeRefForCompletion() + virtual std::vector<std::string> getFlakesForCompletion() { return {}; } + + void completeFlakeInput(std::string_view prefix); + + void completionHook() override; }; struct SourceExprCommand : virtual Args, MixFlakeOptions @@ -121,7 +127,7 @@ struct InstallablesCommand : virtual Args, SourceExprCommand virtual bool useDefaultInstallables() { return true; } - std::optional<FlakeRef> getFlakeRefForCompletion() override; + std::vector<std::string> getFlakesForCompletion() override; protected: @@ -137,9 +143,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: |