dotnet / dotnet/command-line-api

Inappropriate typo suggestion for argument of option

Open
#2,010 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
3.7k
Forks
428
PR merge metrics
No merged PRs in 30d

Description

In --option=argument syntax, if the argument is not accepted by the option, then typo correction can suggest replacing the argument with a different option. That should not happen when they are connected by an equals sign.

## Demo

```XML


Exe
net6.0
enable
enable



```

```C#
using System.CommandLine;

return new RootCommand().Invoke(args);
```

```
$ dotnet run -- --version=h-
'h-' was not matched. Did you mean one of the following?
-h
1.0.0
```

Contributor guide

Open the contributing guide

Research direction

Reproduce the behavior with the System.CommandLine sample using RootCommand and `dotnet run -- --version=h-`. Trace how the `--option=argument` form is parsed and how typo suggestions are generated; done means an invalid argument after `=` no longer suggests a different option while normal option suggestions still work.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.