From c99c084ad097bb5d19ecf1618753aeff360d8fc1 Mon Sep 17 00:00:00 2001 From: rsteube Date: Sun, 2 Apr 2023 21:37:32 +0200 Subject: [PATCH] tmp --- completers/terraform_completer/cmd/root.go | 20 ------------------- completers/terragrunt_completer/cmd/runAll.go | 4 ++-- 2 files changed, 2 insertions(+), 22 deletions(-) diff --git a/completers/terraform_completer/cmd/root.go b/completers/terraform_completer/cmd/root.go index ff768e28fd..ebce63afeb 100644 --- a/completers/terraform_completer/cmd/root.go +++ b/completers/terraform_completer/cmd/root.go @@ -1,9 +1,6 @@ package cmd import ( - "os" - "strings" - "github.com/rsteube/carapace" "github.com/spf13/cobra" "github.com/spf13/pflag" @@ -20,23 +17,6 @@ func Execute() error { return rootCmd.Execute() } -func ActionExecute() carapace.Action { // TODO this still needed / correct? maybe use bridging action - return carapace.ActionCallback(func(c carapace.Context) carapace.Action { - // TODO don't change os.Args - backup := os.Args - for index, arg := range c.Args { - if strings.HasPrefix(arg, "-") && !strings.HasPrefix(arg, "--") { - c.Args[index] = "-" + arg - } - } - if strings.HasPrefix(c.CallbackValue, "-") && !strings.HasPrefix(c.CallbackValue, "--") { - c.CallbackValue = "-" + c.CallbackValue - } - os.Args = backup - return carapace.ActionExecute(rootCmd).Invoke(c).ToA() - }) -} - func init() { carapace.Gen(rootCmd).Standalone() diff --git a/completers/terragrunt_completer/cmd/runAll.go b/completers/terragrunt_completer/cmd/runAll.go index e743533dab..e5adc45deb 100644 --- a/completers/terragrunt_completer/cmd/runAll.go +++ b/completers/terragrunt_completer/cmd/runAll.go @@ -2,7 +2,7 @@ package cmd import ( "github.com/rsteube/carapace" - terraform "github.com/rsteube/carapace-bin/completers/terraform_completer/cmd" + "github.com/rsteube/carapace-bridge/pkg/actions/bridge" "github.com/spf13/cobra" ) @@ -20,6 +20,6 @@ func init() { rootCmd.AddCommand(runAllCmd) carapace.Gen(runAllCmd).PositionalAnyCompletion( - terraform.ActionExecute(), + bridge.ActionCarapaceBin("terraform"), ) }