-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
area/v3relates to / is being considered for v3relates to / is being considered for v3kind/bugdescribes or fixes a bugdescribes or fixes a bugstatus/triagemaintainers still need to look into thismaintainers still need to look into this
Description
My urfave/cli version is
v3.3.8
Checklist
- Are you running the latest v3 release? The list of releases is here.
- Did you check the manual for your release? The v3 manual is here
- Did you perform a search about this problem? Here's the GitHub guide about searching.
Describe the bug
Strings arguments to a StringSliceFlag are always trimmed regardless of the TrimSpace configuration
To reproduce
// See flag_test.go
// Existing test
{
name: "StringSliceFlag valid with TrimSpace",
input: "foo , bar ",
output: []string{"foo", "bar"},
fl: &StringSliceFlag{Name: "names", Sources: EnvVars("NAMES"), Config: StringConfig{TrimSpace: true}},
},
// Add a new test with TrimSpace set to false
{
name: "StringSliceFlag valid without TrimSpace",
input: "foo , bar ",
output: []string{"foo ", " bar "},
fl: &StringSliceFlag{Name: "names", Sources: EnvVars("NAMES"), Config: StringConfig{TrimSpace: false}},
},Observed behavior
Spaces are trimmed regardless:
[]string{"foo", "bar"}Expected behavior
I expected it to preserve spaces with TrimSpace set to false
[]string{"foo ", " bar "}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area/v3relates to / is being considered for v3relates to / is being considered for v3kind/bugdescribes or fixes a bugdescribes or fixes a bugstatus/triagemaintainers still need to look into thismaintainers still need to look into this