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);cs
await Host
.CreateDefaultBuilder()
.ApplyJasperFxExtensions()
.RunJasperFxCommands(args);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);cs
var builder = Host.CreateDefaultBuilder();
builder.ConfigureServices(services =>
{
// Register your services here
});
await builder
.ApplyJasperFxExtensions()
.RunJasperFxCommands(args);Built-in Commands
JasperFx ships with several commands out of the box:
| Command | Description |
|---|---|
help | List all available commands |
describe | Describe the application configuration |
check-env | Run 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
- Writing Commands -- Create synchronous and async commands
- Arguments and Flags -- Define inputs with attributes
- Environment Checks -- Validate runtime dependencies
- Describe -- Customize the describe output
