-
Notifications
You must be signed in to change notification settings - Fork 208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: capture commands should respect --namespace #568
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,10 @@ import ( | |
"k8s.io/cli-runtime/pkg/genericclioptions" | ||
) | ||
|
||
var name string | ||
var opts = struct { | ||
genericclioptions.ConfigFlags | ||
Name *string | ||
}{} | ||
|
||
var capture = &cobra.Command{ | ||
Use: "capture", | ||
|
@@ -18,8 +21,8 @@ var capture = &cobra.Command{ | |
|
||
func init() { | ||
cmd.Retina.AddCommand(capture) | ||
configFlags = genericclioptions.NewConfigFlags(true) | ||
configFlags.AddFlags(capture.PersistentFlags()) | ||
capture.PersistentFlags().StringVar(&name, "name", "", "The name of the Retina Capture") | ||
opts.ConfigFlags = *genericclioptions.NewConfigFlags(true) | ||
opts.AddFlags(capture.PersistentFlags()) | ||
capture.PersistentFlags().StringVar(opts.Name, "name", "", "The name of the Retina Capture") | ||
Comment on lines
+25
to
+26
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know it's a small thing here, but this might be better as a method of Not a blocker, but just an idea. |
||
_ = capture.MarkPersistentFlagRequired("name") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can borrow what kubectl cli has been achieved here? Like https://github.com/kubernetes/kubectl/blob/master/pkg/cmd/create/create_cronjob.go
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
^^ it's for this change, we can improve later.
Thanks for fixing missing namespace flag.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's the direction I am moving with this change, but it is just the first small step