mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-07-06 12:38:15 +08:00
Add possibility to set description and/or data for the default command (#1091)
This commit is contained in:
@ -25,11 +25,25 @@ public sealed class CommandAppTester
|
||||
/// <summary>
|
||||
/// Sets the default command.
|
||||
/// </summary>
|
||||
/// <param name="description">The optional default command description.</param>
|
||||
/// <param name="data">The optional default command data.</param>
|
||||
/// <typeparam name="T">The default command type.</typeparam>
|
||||
public void SetDefaultCommand<T>()
|
||||
public void SetDefaultCommand<T>(string? description = null, object? data = null)
|
||||
where T : class, ICommand
|
||||
{
|
||||
_appConfiguration = (app) => app.SetDefaultCommand<T>();
|
||||
_appConfiguration = (app) =>
|
||||
{
|
||||
var defaultCommandBuilder = app.SetDefaultCommand<T>();
|
||||
if (description != null)
|
||||
{
|
||||
defaultCommandBuilder.WithDescription(description);
|
||||
}
|
||||
|
||||
if (data != null)
|
||||
{
|
||||
defaultCommandBuilder.WithData(data);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
Reference in New Issue
Block a user