BlazorFocused.Automation.CommandLine 1.1.0-preview2

This is a prerelease version of BlazorFocused.Automation.CommandLine.
dotnet add package BlazorFocused.Automation.CommandLine --version 1.1.0-preview2                
NuGet\Install-Package BlazorFocused.Automation.CommandLine -Version 1.1.0-preview2                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="BlazorFocused.Automation.CommandLine" Version="1.1.0-preview2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add BlazorFocused.Automation.CommandLine --version 1.1.0-preview2                
#r "nuget: BlazorFocused.Automation.CommandLine, 1.1.0-preview2"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install BlazorFocused.Automation.CommandLine as a Cake Addin
#addin nuget:?package=BlazorFocused.Automation.CommandLine&version=1.1.0-preview2&prerelease

// Install BlazorFocused.Automation.CommandLine as a Cake Tool
#tool nuget:?package=BlazorFocused.Automation.CommandLine&version=1.1.0-preview2&prerelease                

Nuget Version Nuget Downloads Continuous Integration

BlazorFocused.Automation.Runtime

Dependency Injection Framework for C# Console Applications

NuGet Packages

Package Description
BlazorFocused.Automation.CommandLine Dependency Injection Framework for C# Console Applications

Documentation

Please visit the BlazorFocused.Automation Documentation Site for installation, getting started, and API documentation.

Samples

Please visit and/or download our BlazorFocused.Automation.CommandLine Sample Solution to get a more in-depth view of usage.

Installation

.NET CLI


dotnet add package BlazorFocused.Automation.CommandLine

Development

Create Automation Console Command to run

public class TestCommand : StandardCommand
{
    public override void ConfigureCommand(IServiceBinderFactory serviceBinderFactory, Command command)
    {
        var greetingOption = new Option<string>(
            name: "--greeting",
            description: "New greeting to display.");

        command.AddOption(greetingOption);

        command.SetHandler(UpdateGreeting,
            greetingOption,
            serviceBinderFactory.Bind<ITestService>(),
            serviceBinderFactory.Bind<IConfiguration>());
    }

    public override void Configure(HostBuilderContext hostBuilderContext, IConfigurationBuilder configurationBuilder)
    {
        var appSettings = new Dictionary<string, string>()
        {
            ["CurrentGreetingMessage"] = "Current Greeting: {0}",
            ["NewGreetingMessage"] = "New Greeting: {0}"
        };

        configurationBuilder.AddInMemoryCollection(appSettings);
    }

    public override void ConfigureServices(HostBuilderContext hostBuilderContext, IServiceCollection services)
    {
        serviceCollection.AddScoped<ITestService, TestService>();
    }

    private void UpdateGreeting(
        string newGreeting,
        ITestService testService,
        IConfiguration configuration)
    {
        string unformattedCurrentGreeting = configuration.GetValue<string>("CurrentGreetingMessage");
        string unformattedNewGreeting = configuration.GetValue<string>("NewGreetingMessage");

        string currentGreeting = testService.GetGreeting();

        Console.WriteLine(unformattedCurrentGreeting, currentGreeting);

        string updatedGreeting = testService.UpdateGreeting(newGreeting);

        Console.WriteLine(unformattedNewGreeting, updatedGreeting);
    }
}

Add Automation Console Builder in startup

class Program
{
    static void Main(string[] args)
    {
        IAutomationConsoleBuilder builder =
            // Passing in "args" is optional
            AutomationConsole.CreateDefaultBuilder(args)
                // Add command name/path here
                .AddCommand<TestCommand>("greet");

        IAutomationConsole console = builder.Build();

        console.Run();
    }
}

Run command

dotnet run -- greet --greeting "Hello World"

Other Resources

Package Description
BlazorFocused.Automation.Runtime Runtime services for BlazorFocused.Automation framework
BlazorFocused.Automation.PowerShell PowerShell PSCmdlet SDK utilities for Automation framework development
BlazorFocused.Automation.PowerShell.Tools Development tools for running/testing PSCmdlets built with Automation framework
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  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.  net9.0 is compatible. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.0-preview2 47 11/28/2024
1.1.0-preview1 55 11/21/2024
1.0.0-preview1 72 2/27/2024
1.0.0-alpha1 82 9/29/2023