aboutsummaryrefslogtreecommitdiff
path: root/src/nix/why-depends.cc
diff options
context:
space:
mode:
authorNaïm Favier <n@monade.li>2021-12-20 19:57:48 +0100
committerNaïm Favier <n@monade.li>2021-12-20 19:58:30 +0100
commit1827cf5a9b8fa0f8f1dff1ee775f67f7f326606c (patch)
treeaf17494c47c4193343458d421fe36f56a1b4d29a /src/nix/why-depends.cc
parent6e6e998930f0d7361d64644eb37d9134e74e8501 (diff)
Add shell completion for why-depends
Fixes #5806
Diffstat (limited to 'src/nix/why-depends.cc')
-rw-r--r--src/nix/why-depends.cc17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/nix/why-depends.cc b/src/nix/why-depends.cc
index 2f6b361bb..e27f56ef5 100644
--- a/src/nix/why-depends.cc
+++ b/src/nix/why-depends.cc
@@ -34,8 +34,21 @@ struct CmdWhyDepends : SourceExprCommand
CmdWhyDepends()
{
- expectArg("package", &_package);
- expectArg("dependency", &_dependency);
+ expectArgs({
+ .label = "package",
+ .handler = {&_package},
+ .completer = {[&](size_t, std::string_view prefix) {
+ completeInstallable(prefix);
+ }}
+ });
+
+ expectArgs({
+ .label = "dependency",
+ .handler = {&_dependency},
+ .completer = {[&](size_t, std::string_view prefix) {
+ completeInstallable(prefix);
+ }}
+ });
addFlag({
.longName = "all",