From 1827cf5a9b8fa0f8f1dff1ee775f67f7f326606c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Na=C3=AFm=20Favier?= Date: Mon, 20 Dec 2021 19:57:48 +0100 Subject: [PATCH] Add shell completion for why-depends Fixes #5806 --- src/nix/why-depends.cc | 17 +++++++++++++++-- 1 file 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",