ko-build / ko-build/ko

Use Cobra flag helpers for better shell completion

Open
#541 6 comments 0 reactions 1 assignee Claimed by @MohabMohamed View on GitHub
good first issue lifecycle/frozen
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.