commandlineparser / commandlineparser/commandline

Default verb treated as a value.

Aberta
#794 1 comentário 0 reações 0 responsáveis Ver no GitHub
Linguagem predominante
C#
Estrelas
4.8k
Forks
478
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

This was seen on version 2.8.0 targeting .NET Core 3.1 / 5.

Minimum code sample:
```
void Main()
{
var parser = new Parser();
var result = parser.ParseArguments(new[] { "copy", @"A:\", @"C:\", });
result
.WithParsed(a =>
{
Console.WriteLine(a.SourcePath);
Console.WriteLine(a.DestinationPath);
});
}

[Verb("copy", isDefault: true)]
class CopyArguments
{
[Value(0, MetaName = "source", Required = true)]
public string? SourcePath { get; set; }

[Value(1, MetaName = "destination", Required = true)]
public string? DestinationPath { get; set; }
}
````

This prints "copy" for `SourcePath` and "A:\\" for `DestinationPath`.

At this point in development I only have one verb (more verbs are planned), and that verb is/will be the default one.

Guia de contribuição

Nenhum guia de contribuição indexado para este repositório

Direção de pesquisa

Start by reproducing the sample through Parser.ParseArguments with the [Verb] and [Value] attributes shown. Trace how the default verb is handled before positional values are assigned, then add or update a regression test proving SourcePath receives A:\ and DestinationPath receives C:\ when the default verb is omitted from the arguments.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Stack de tecnologia
csharp
Domínio
cli
Tipo de issue
Bug
Dificuldade
3/5
Tempo estimado
1-2 dias
Status de atividade
Estagnada
Clareza
Razoavelmente clara
Facilidade para iniciantes
45/100

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.