From f744713d8169b387a88832f18ab6e8616951178e Mon Sep 17 00:00:00 2001 From: alliasgher Date: Tue, 14 Apr 2026 03:43:45 +0500 Subject: [PATCH] command: apply SliceFlagSeparator to env-var values in PostParse setMultiValueParsingConfig was only called from cmd.set(), which is invoked when parsing command-line flags. When flag values came from an environment variable they were processed in flag.PostParse() which did not have the separator configured on the value, so the default "," separator was used regardless of the command's SliceFlagSeparator. Call setMultiValueParsingConfig for each flag in the PostParse loop so the separator is configured before any env-var lookup. Fixes #2262 Signed-off-by: alliasgher --- command_run.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/command_run.go b/command_run.go index 8a135a7732..209e854b89 100644 --- a/command_run.go +++ b/command_run.go @@ -215,6 +215,10 @@ func (cmd *Command) run(ctx context.Context, osArgs []string) (_ context.Context for _, flag := range cmd.allFlags() { cmd.setMultiValueParsingConfig(flag) isSet := flag.IsSet() + // Propagate the command's slice/map separator config before PostParse + // so that env-var values are split with the same separator as CLI + // values (see https://github.com/urfave/cli/issues/2262). + cmd.setMultiValueParsingConfig(flag) if err := flag.PostParse(); err != nil { return ctx, err }