For asynchronous operations, use ConsoleApp.RunAsync. You can optionally include a CancellationToken as a parameter in your lambda.
When a CancellationToken is present, the framework uses PosixSignalRegistration to handle SIGINT, SIGTERM, and SIGKILL (e.g., via Ctrl+C). If the signal is received, the token is marked as CancellationRequested, allowing for a graceful shutdown. If you do not include the CancellationToken in your method signature, these signals will not be handled and the program will terminate immediately.
using ConsoleAppFramework;
// --foo, --bar
await ConsoleApp.RunAsync(args, async (int foo, int bar, CancellationToken cancellationToken) =>
{
await Task.Delay(TimeSpan.FromSeconds(5), cancellationToken);
Console.WriteLine($"Sum: {foo + bar}");
});