Use Cobra flag helpers for better shell completion
- Dominant language
- Go
- Stars
- 8.5k
- Forks
- 447
- PR merge metrics
- No merged PRs in 30d
Description
Cobra has a helper methods which can make shell completion a little nicer:
- [`MarkFlagFilename`](https://pkg.go.dev/github.com/spf13/cobra#MarkFlagFilename) tells Cobra that the flag represents a filename. This tells the `ko completion` logic to generate helpers to match filenames. (e.g., `ko apply -f `)
- [`MarkFlagRequired`](https://pkg.go.dev/github.com/spf13/cobra#MarkFlagRequired) tells Cobra that the flag is required, and prioritizes in completion if it's unset (e.g., `ko apply ` prioritizes `-f` over `--preserve-import-paths`).
Audit flags we configure and see if there are any that would benefit from being marked this way. Check that the expected behavior is actually observed when shell completion is configured.
Contributor guide
Assessment
This issue has not been assessed yet.