Repository navigation
Join map-source slice values with the command separator - #2549
Open
joshbarros wants to merge 2 commits into
Open
joshbarros wants to merge 2 commits into
joshbarros wants to merge 2 commits into
Conversation
NewMapValueSource formatted a list with %+v, so slice flags received one value like "[80 443]" instead of separate elements. Join slice and array values with commas, matching the command-line and cli-altsrc behavior; update the map source expectation.
Map-backed slice values now join elements with the owning command's effective SliceFlagSeparator, including when the source is wrapped in a nested ValueSourceChain. This keeps elements containing commas intact when a different separator is configured.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2516
NewMapValueSourceformatted a list with%+v, so slice flags received a single value like"[80 443]"and failed to parse, or aStringSliceFlaggot one element"[a b]"instead of two.For slice and array values, join the elements with the owning command's effective
SliceFlagSeparator(comma by default), including through nestedValueSourceChainvalues. Slice flags therefore receive separate elements, and elements containing commas stay intact when a non-comma separator is configured. Scalar values keep the existing formatting.Adds tests for the default separator, a custom separator with comma-containing elements, and a nested source chain.
go test ./...passes.