Skip to content

Commit baf01a0

Browse files
committed
tmp
1 parent f58502d commit baf01a0

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

cmd/carapace-aws/cmd/root.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
spec "github.com/carapace-sh/carapace-spec"
1010
"github.com/carapace-sh/carapace/pkg/style"
1111
"github.com/spf13/cobra"
12+
"github.com/spf13/pflag"
1213
)
1314

1415
var rootCmd = &cobra.Command{
@@ -63,7 +64,17 @@ func init() {
6364
if err != nil {
6465
panic("NARF") // TODO handle error
6566
}
66-
serviceCmd.AddCommand(botoCommand.ToCobra())
67+
operationCmd := botoCommand.ToCobra()
68+
serviceCmd.AddCommand(operationCmd)
69+
70+
carapace.Gen(operationCmd).PreInvoke(func(cmd *cobra.Command, flag *pflag.Flag, action carapace.Action) carapace.Action {
71+
if flag != nil && flag.Value.Type() == "string" {
72+
if _, ok := botoCommand.Completion.Flag[flag.Name]; !ok {
73+
return common.ActionBridgeAwsCompleter()
74+
}
75+
}
76+
return action
77+
})
6778
}
6879
})
6980
}

0 commit comments

Comments
 (0)