Add shell completion for valid --json flag values#3628
Conversation
samcoe
left a comment
There was a problem hiding this comment.
Code looks good to me. We have not added flag shell completion in the past, what is the reason for adding it for json? Are we worried about it not working across all shells? I know we have had issues opened up in the past about how poor the completions work in some shells.
We haven't, but
It will work across bash, zsh, fish, and PowerShell due to Cobra's recently improved completion support. When it doesn't, it's an issue that we should raise in Cobra's issue tracker. |
Notes:
cobra.ShellCompDirectiveNoSpaceisn't actually effective in zsh, but that will be fixed in Cobra 1.2.0 Fix zsh completion handling of nospace and file completion spf13/cobra#1213