augustoproiete / Cake.Args

:cake: :jigsaw: Cake addin that adds Arguments extensions in Cake builds

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

README.md

Cake.Args

Cake.Args

Cross-platform addin for the Cake build automation system that adds Arguments extensions in Cake build scripts. The latest version of Cake.Args targets .NET 7.0, and .NET 6.0.

NuGet Version Stack Overflow Cake Build All Contributors

Give a Star! ⭐

If you like or are using this project please give it a star. Thanks!

Getting started 🚀

Simply add Cake.Args in your build script by using the addin directive:

#addin "nuget:?package=Cake.Args&version=3.0.0"

Make sure the &version= attribute references the latest version of Cake.Args compatible with the Cake runner that you are using. Check the compatibility table to see which version of Cake.Args to choose.

And you're ready to use the arguments extensions in your Cake build script:

#addin "nuget:?package=Cake.Args&version=3.0.0"

var configuration =
    ArgumentOrDefault<string>("configuration") ??
    ArgumentOrDefault<string>("config") ??
    "Release";

var majorVersion =
    ArgumentOrDefault<int?>("majorVersion") ??
    ArgumentOrDefault<int?>("major");

Task("Example")
    .Does(context =>
{
    var settings = new DotNetBuildSettings
    {
        Configuration = configuration,
    };

    if (majorVersion.HasValue)
    {
        settings.VersionSuffix = $"{majorVersion}.0.0";
    }

    DotNetBuild("./MyProject.sln", settings);
});

RunTarget("Example");

Arguments extensions available

Method Description
ArgumentOrDefault<T> Returns an argument value by name or default(T) if the argument is missing.

Compatibility

Cake.Args is compatible with all Cake runners, and below you can find which version of Cake.Args you should use based on the version of the Cake runner you're using.

Cake runner Cake.Args Cake addin directive
3.0.0 or higher 3.0.0 or higher #addin "nuget:?package=Cake.Args&version=3.0.0"
2.0.0 - 2.3.0 2.0.0 #addin "nuget:?package=Cake.Args&version=2.0.0"
1.0.0 - 1.3.0 1.0.0 - 1.0.1 #addin "nuget:?package=Cake.Args&version=1.0.1"
0.33.0 - 0.38.5 0.1.0 #addin "nuget:?package=Cake.Args&version=0.1.0"
< 0.33.0 N/A (not supported)

Discussion

For questions and to discuss ideas & feature requests, use the GitHub discussions on the Cake GitHub repository, under the Extension Q&A category.

Join in the discussion on the Cake repository

Contributors

Thanks goes to these wonderful people (emoji key):

C. Augusto Proiete
C. Augusto Proiete

💻 🚧
Carlos Proiete
Carlos Proiete

🚧

Release History

Click on the Releases tab on GitHub.


Copyright © 2021-2023 C. Augusto Proiete & Contributors - Provided under the MIT License.

About

:cake: :jigsaw: Cake addin that adds Arguments extensions in Cake builds

License:MIT License


Languages

Language:C# 94.6%Language:PowerShell 2.4%Language:Shell 1.6%Language:Batchfile 1.4%