dotnet / dotnet/command-line-api
Option with non-eager optional argument, like --backup[=CONTROL]
- Dominant language
- C#
- Stars
- 3.7k
- Forks
- 428
- PR merge metrics
- No merged PRs in 30d
Description
In GNU `getopt_long`, if an option has an optional argument, then it has to be in the same element of `char *argv[]`, connected with an equals sign. Thus, `numbered` is parsed as the argument of the option in `cp --backup=numbered source directory/` but as a separate argument (and treated as a file name) in `cp --backup numbered source directory/`. AFAICT, System.CommandLine cannot be configured to behave this way.
Contributor guide
Research direction
Start by comparing System.CommandLine's optional-argument parsing with GNU getopt_long behavior described in the issue, especially the distinction between --backup=numbered and --backup numbered. Trace the parser entry points and existing tests, then add coverage showing that an optional argument is accepted only when attached with an equals sign, while the separate token remains a positional argument.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100