From b4e7cb44abbd94815733284dbd1c5b59f7dcc0ae Mon Sep 17 00:00:00 2001 From: rsteube Date: Sun, 22 Dec 2024 21:43:23 +0100 Subject: [PATCH] nix: re-add directory completion --- completers/nix_completer/cmd/build.go | 5 ++++- completers/nix_completer/cmd/develop.go | 5 ++++- pkg/actions/tools/nix/flake.go | 1 - 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/completers/nix_completer/cmd/build.go b/completers/nix_completer/cmd/build.go index 5125c9f2d5..76331b1d5e 100644 --- a/completers/nix_completer/cmd/build.go +++ b/completers/nix_completer/cmd/build.go @@ -41,6 +41,9 @@ func init() { }) carapace.Gen(buildCmd).PositionalCompletion( - nix.ActionFlakeRefs(), + carapace.Batch( + carapace.ActionDirectories(), + nix.ActionFlakeRefs(), + ).ToA(), ) } diff --git a/completers/nix_completer/cmd/develop.go b/completers/nix_completer/cmd/develop.go index a4d0c56eb6..186c2ccdce 100644 --- a/completers/nix_completer/cmd/develop.go +++ b/completers/nix_completer/cmd/develop.go @@ -52,6 +52,9 @@ func init() { }) carapace.Gen(developCmd).PositionalCompletion( - nix.ActionFlakeRefs(), + carapace.Batch( + carapace.ActionDirectories(), + nix.ActionFlakeRefs(), + ).ToA(), ) } diff --git a/pkg/actions/tools/nix/flake.go b/pkg/actions/tools/nix/flake.go index ac3a290a43..acf2ea148b 100644 --- a/pkg/actions/tools/nix/flake.go +++ b/pkg/actions/tools/nix/flake.go @@ -128,7 +128,6 @@ func ActionFlakeRefs() carapace.Action { return carapace.ActionMultiPartsN("#", 2, func(c carapace.Context) carapace.Action { switch len(c.Parts) { case 0: - // TODO add directory completion externally return ActionFlakes().Suffix("#") default: return ActionFlakeAttributes(c.Parts[0])