Skip to content

Command Line Tooling

JasperFx includes a lightweight CLI framework for building commands that integrate with Microsoft.Extensions.Hosting.

Enabling the CLI

Wire up the JasperFx command line by calling ApplyJasperFxExtensions on your host builder:

cs
await Host
    .CreateDefaultBuilder()
    .ApplyJasperFxExtensions()
    .RunJasperFxCommands(args);

snippet source | anchor

cs
await Host
    .CreateDefaultBuilder()
    .ApplyJasperFxExtensions()
    .RunJasperFxCommands(args);

snippet source | anchor

Alternatively, use RunJasperFxCommands for more control over host configuration:

cs
var builder = Host.CreateDefaultBuilder();

builder.ConfigureServices(services =>
{
    // Register your services here
});

await builder
    .ApplyJasperFxExtensions()
    .RunJasperFxCommands(args);

snippet source | anchor

cs
var builder = Host.CreateDefaultBuilder();

builder.ConfigureServices(services =>
{
    // Register your services here
});

await builder
    .ApplyJasperFxExtensions()
    .RunJasperFxCommands(args);

snippet source | anchor

Built-in Commands

JasperFx ships with several commands out of the box:

CommandDescription
helpList all available commands
describeDescribe the application configuration
check-envRun all registered environment checks

Command Discovery

Commands are discovered automatically from referenced assemblies that carry the [JasperFxTool] attribute. Your own commands are found through assembly scanning.

Topics

Released under the MIT License.