Skip to content

Different target argument values depending on specifying --target or --Target #4355

@paulomorgado

Description

@paulomorgado

Prerequisites

  • I have written a descriptive issue title
  • I have searched issues to ensure it has not already been reported

Cake runner

Cake Frosting

Cake version

4.0.0

Operating system

Windows

Operating system architecture

64-Bit

CI Server

No response

What are you seeing?

If I specify the target as --target some-target in the command-line, I get just some-target for the target argument.

If I specify the target as --Target some-target in the command-line, I get some-target and Default for the Target argument.

This causes context.Argument("target", "Default") to return different values depending on having specified target or Target.

What is expected?

I expected both options the have the same behavior, since the arguments dictionary uses a ordinal ignore case comparer.

Steps to Reproduce

With this simple program:

new CakeHost()
    .Run(args);


[TaskName("Default")]
public class Default : FrostingTask<ICakeContext>
{
    public override void Run(ICakeContext context)
    {
        context.Log.Information($"target: {string.Join(',', context.Arguments.GetArguments("target"))}");
        base.Run(context);
    }
}

[TaskName("some target")]
public class SomeTarget : FrostingTask<ICakeContext>
{
    public override void Run(ICakeContext context)
    {
        context.Log.Information($"target: {string.Join(',', context.Arguments.GetArguments("target"))}");
        base.Run(context);
    }
}

you get different results depending how you invoke it:

dotnet run ... -- --target "some target"

========================================
some target
========================================
target: some target
dotnet run ... -- --Target "some target"

========================================
Default
========================================
target: some target,Default

Output log

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions