Luna.DevTools.Core
1.0.4
dotnet add package Luna.DevTools.Core --version 1.0.4
NuGet\Install-Package Luna.DevTools.Core -Version 1.0.4
<PackageReference Include="Luna.DevTools.Core" Version="1.0.4" />
paket add Luna.DevTools.Core --version 1.0.4
#r "nuget: Luna.DevTools.Core, 1.0.4"
// Install Luna.DevTools.Core as a Cake Addin
#addin nuget:?package=Luna.DevTools.Core&version=1.0.4
// Install Luna.DevTools.Core as a Cake Tool
#tool nuget:?package=Luna.DevTools.Core&version=1.0.4
About
DevTools Core is package designed to help create CLI tools that automate repetitive tasks. It offers robust support for command-line parsing, command creation, and more.
How to use
Install Luna.DevTools.Core
NuGet package
dotnet add package Luna.DevTools.Core
Create a new class that inherits from CommandBase
and override the ExecuteAsync
method. This method will be called when the command is executed. Add the Command
attribute to the class and provide the command name as the first argument.
[Command("my-command")]
public class MyCommand : CommandBase
{
public override async Task<bool> ExecuteAsync();
{
Console.WriteLine("Hello, World!");
return true;
}
}
In the Program.cs
file, create a new instance of the CliApplicationBuilder
class and add the command to it and build the application instance.
var app = CliApplication.CreateBuilder(args)
.AddCommand<MyCommand>()
.Build();
Finally, run the application with the RunAsync
method.
await app.RunAsync();
Build the application and run it. As a result, the command my-command
will be available in the CLI application.
For the example above, the output for application called CliToolApp
will be:
$ CliToolApp my-command
Hello, World!
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net8.0
- Microsoft.Extensions.DependencyInjection (>= 8.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.