Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
rsteube committed Apr 2, 2023
1 parent a96b929 commit c99c084
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 22 deletions.
20 changes: 0 additions & 20 deletions completers/terraform_completer/cmd/root.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
package cmd

import (
"os"
"strings"

"github.com/rsteube/carapace"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
Expand All @@ -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()

Expand Down
4 changes: 2 additions & 2 deletions completers/terragrunt_completer/cmd/runAll.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand All @@ -20,6 +20,6 @@ func init() {
rootCmd.AddCommand(runAllCmd)

carapace.Gen(runAllCmd).PositionalAnyCompletion(
terraform.ActionExecute(),
bridge.ActionCarapaceBin("terraform"),
)
}

0 comments on commit c99c084

Please sign in to comment.