Direct mode - adambajguz/Typin GitHub Wiki

Direct CLI mode is the simples and most basic mode available in Typin. It simply executes a command passed to application in its arguments and then requests the application stop.

If no mode was registered or none of the registered modes was marked as startup DirectMode will be registered.

/// <summary>
/// Direct CLI mode. If no mode was registered or none of the registered modes was marked as startup, <see cref="DirectMode"/> will be registered.
/// </summary>
public class DirectMode : ICliMode
{
    private readonly ICliApplicationLifetime _applicationLifetime;

    /// <summary>
    /// Initializes an instance of <see cref="DirectMode"/>.
    /// </summary>
    public DirectMode(ICliApplicationLifetime applicationLifetime)
    {
        _applicationLifetime = applicationLifetime;
    }

    /// <inheritdoc/>
    public async ValueTask<int> ExecuteAsync(IEnumerable<string> commandLineArguments, ICliCommandExecutor executor)
    {
        int exitCode = await executor.ExecuteCommandAsync(commandLineArguments);
        _applicationLifetime.RequestStop();

        return exitCode;
    }
}
⚠️ **GitHub.com Fallback** ⚠️