Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions pkg/cmd/tools.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package cmd

import (
"context"
"fmt"
"os"

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

func NewToolsCommand(name string, cliName string, resource schema.GroupVersionResource, settings api.Settings, opts ...func(cfg clientcmd.ClientConfig)) *cobra.Command {
func NewToolsCommand(name string, cliName string, resource schema.GroupVersionResource, settings api.Settings, opts ...func(ctx context.Context, cfg clientcmd.ClientConfig)) *cobra.Command {
var (
cmdContext = commandContext{
Settings: settings,
Expand Down Expand Up @@ -55,7 +56,7 @@ func NewToolsCommand(name string, cliName string, resource schema.GroupVersionRe
clientConfig := addK8SFlagsToCmd(&command)
command.PersistentPreRun = func(cmd *cobra.Command, args []string) {
for i := range opts {
opts[i](clientConfig)
opts[i](cmd.Context(), clientConfig)
}
ns, _, err := clientConfig.Namespace()
if err != nil {
Expand Down
Loading