Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
2 tasks done
paulomorgado opened this issue Oct 8, 2024 · 1 comment · Fixed by #4357
Closed
2 tasks done
Assignees
Milestone

Comments

@paulomorgado
Copy link
Contributor

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

@devlead devlead self-assigned this Oct 14, 2024
@devlead devlead added this to the v4.1.0 milestone Oct 14, 2024
devlead added a commit that referenced this issue Oct 14, 2024
GH4355: Frosting support Pascal Case Target argument
@cake-build-bot
Copy link

🎉 This issue has been resolved in version v4.1.0 🎉

The release is available on:

Your GitReleaseManager bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants