Skip to content

Commit 72c1c5c

Browse files
authored
Merge pull request #3070 from carapace-sh/aws-carapace
aws: implicitly bridge `carapace-aws` when in PATH
2 parents 281eb92 + 983a6a8 commit 72c1c5c

File tree

1 file changed

+6
-0
lines changed
  • completers/common/aws_completer/cmd

1 file changed

+6
-0
lines changed

completers/common/aws_completer/cmd/root.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
package cmd
22

33
import (
4+
"os/exec"
45
"strings"
56

67
"github.com/carapace-sh/carapace"
8+
"github.com/carapace-sh/carapace-bridge/pkg/actions/bridge"
79
"github.com/carapace-sh/carapace/pkg/style"
810
"github.com/spf13/cobra"
911
)
@@ -25,6 +27,10 @@ func init() {
2527

2628
carapace.Gen(rootCmd).PositionalAnyCompletion(
2729
carapace.ActionCallback(func(c carapace.Context) carapace.Action {
30+
if _, err := exec.LookPath("carapace-aws"); err == nil {
31+
return bridge.ActionCarapace("carapace-aws")
32+
}
33+
2834
if c.Value == "-" {
2935
c.Value += "-" // no shorthand flags so expand to longhand first (which is needed for the completer)
3036
}

0 commit comments

Comments
 (0)