Skip to content

Commit 6843172

Browse files
committed
propagate context to options
Signed-off-by: sivchari <[email protected]>
1 parent e3fe626 commit 6843172

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pkg/cmd/tools.go

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

33
import (
4+
"context"
45
"fmt"
56
"os"
67

@@ -26,7 +27,7 @@ func addOutputFlags(cmd *cobra.Command, output *string) {
2627
cmd.Flags().StringVarP(output, "output", "o", "wide", "Output format. One of:json|yaml|wide|name")
2728
}
2829

29-
func NewToolsCommand(name string, cliName string, resource schema.GroupVersionResource, settings api.Settings, opts ...func(cfg clientcmd.ClientConfig)) *cobra.Command {
30+
func NewToolsCommand(name string, cliName string, resource schema.GroupVersionResource, settings api.Settings, opts ...func(ctx context.Context, cfg clientcmd.ClientConfig)) *cobra.Command {
3031
var (
3132
cmdContext = commandContext{
3233
Settings: settings,
@@ -55,7 +56,7 @@ func NewToolsCommand(name string, cliName string, resource schema.GroupVersionRe
5556
clientConfig := addK8SFlagsToCmd(&command)
5657
command.PersistentPreRun = func(cmd *cobra.Command, args []string) {
5758
for i := range opts {
58-
opts[i](clientConfig)
59+
opts[i](cmd.Context(), clientConfig)
5960
}
6061
ns, _, err := clientConfig.Namespace()
6162
if err != nil {

0 commit comments

Comments
 (0)