-
Notifications
You must be signed in to change notification settings - Fork 404
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
Add Cobra flag helpers for file options #705
Conversation
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). For more information, open the CLA check for this pull request. |
pkg/commands/options/filestuff.go
Outdated
@@ -34,6 +34,24 @@ func AddFileArg(cmd *cobra.Command, fo *FilenameOptions) { | |||
"Filename, directory, or URL to files to use to create the resource") | |||
cmd.Flags().BoolVarP(&fo.Recursive, "recursive", "R", fo.Recursive, | |||
"Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.") | |||
|
|||
err := cmd.MarkFlagFilename("filename", "yaml", "yml", "json") |
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.
Have you checked that the combination of MarkFlagFilename
and MarkFlagDirname
work together, to prefer shell completion for file names or directory names? It's not clear from the docs that these won't conflict. I can also check if that would be helpful.
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.
sorry for coming back late as I was busy.
Have you checked that the combination of
MarkFlagFilename
andMarkFlagDirname
work together, to prefer shell completion for file names or directory names? It's not clear from the docs that these won't conflict. I can also check if that would be helpful.
I can't get kubectl to work on my local machine, and the docs are not clear. but however I checked cobra's source code, and it handles this part by a map called annotations and filename has a key different from FlagDirname and it iterates on the keys while doing auto-completion.
so if you got some time can you check it's behavior?
This Pull Request is stale because it has been open for 90 days with |
hello @imjasonh , |
This Pull Request is stale because it has been open for 90 days with |
Fixes #541