commandlineparser / commandlineparser/commandline

Join IEnumerable defaults with separator instead of space

Open
#951 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
4.8k
Forks
478
PR merge metrics
No merged PRs in 30d

Description

Source:
```cs
#:package CommandLineParser@2.9.1

using CommandLine;

return Parser.Default.ParseArguments(args).MapResult(
(Opts opts) => 0,
errors => 2
);

class Opts {
[Option("opt", Required = true, Separator = ',', Default = new[] { "AAA", "BBB", "CCC" }, HelpText = "boolean arg.")]
public IEnumerable MyOption { get; set; }
}
```

Output with `--help`:
```
test_cmdline 1.0.0
Copyright (C) 2026 test_cmdline

--opt Required. (Default: AAA BBB CCC) boolean arg.

--help Display this help screen.

--version Display version information.
```

Notice that the default argument's values are joined by spaces, which is misleading.
Since a separator is provided it should be used instead, so that the user could just copy-paste the resulting value directly and use it as argument. Currently there is no way to achieve this: see [here](https://github.com/commandlineparser/commandline/blob/1e3607b97af6141743edb3c434c06d5b492f6fb3/src/CommandLine/Text/HelpText.cs#L1125).

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.