Skip to content

main: dont allow multi-string flags#540

Closed
supakeen wants to merge 2 commits into
osbuild:mainfrom
supakeen:dont-accept-strings-multiple-times
Closed

main: dont allow multi-string flags#540
supakeen wants to merge 2 commits into
osbuild:mainfrom
supakeen:dont-accept-strings-multiple-times

Conversation

@supakeen

@supakeen supakeen commented Jun 2, 2026

Copy link
Copy Markdown
Member

Previously we applied the set once idiom only to the --blueprint flag.
I feel that the behavior is surprising and should be applied to all
string-typed flags. This commit does just that.

Also does the same for StringVar's.


Rebased on top of #539.

supakeen added 2 commits June 2, 2026 11:11
Cobra by default lets us pass string values multiple times and uses the
last one. This is confusing and was reported to be confusing on the
`--blueprint` flag.

Let's address it there with a new type that only allows a single value
to be set. We might want to expand this to all string-type flags.

Signed-off-by: Simon de Vlieger <cmdr@supakeen.com>
Previously we applied the set once idiom only to the `--blueprint` flag.
I feel that the behavior is surprising and should be applied to all
string-typed flags. This commit does just that.

Also does the same for StringVar's.

Signed-off-by: Simon de Vlieger <cmdr@supakeen.com>
@supakeen supakeen closed this Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant