Skip to content

Inappropriate typo suggestion for argument of option #2010

@KalleOlaviNiemitalo

Description

@KalleOlaviNiemitalo

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

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net6.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
  </ItemGroup>

</Project>
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions