using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Spectre.Console.Cli;
///
/// The entry point for a command line application with a default command.
///
/// The type of the default command.
public sealed class CommandApp : ICommandApp
where TDefaultCommand : class, ICommand
{
private readonly CommandApp _app;
///
/// Initializes a new instance of the class.
///
/// The registrar.
public CommandApp(ITypeRegistrar? registrar = null)
{
_app = new CommandApp(registrar);
_app.GetConfigurator().SetDefaultCommand();
}
///
/// Configures the command line application.
///
/// The configuration.
public void Configure(Action configuration)
{
_app.Configure(configuration);
}
///
/// Runs the command line application with specified arguments.
///
/// The arguments.
/// The exit code from the executed command.
public int Run(IEnumerable args)
{
return _app.Run(args);
}
///
/// Runs the command line application with specified arguments.
///
/// The arguments.
/// The exit code from the executed command.
public Task RunAsync(IEnumerable args)
{
return _app.RunAsync(args);
}
}