mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-08-02 18:17:30 +08:00
Add ability to pass example args using params
syntax (#1166)
This commit is contained in:
@ -10,7 +10,7 @@ public interface ICommandConfigurator
|
||||
/// </summary>
|
||||
/// <param name="args">The example arguments.</param>
|
||||
/// <returns>The same <see cref="ICommandConfigurator"/> instance so that multiple calls can be chained.</returns>
|
||||
ICommandConfigurator WithExample(string[] args);
|
||||
ICommandConfigurator WithExample(params string[] args);
|
||||
|
||||
/// <summary>
|
||||
/// Adds an alias (an alternative name) to the command being configured.
|
||||
|
@ -14,8 +14,8 @@ public interface IConfigurator
|
||||
/// Adds an example of how to use the application.
|
||||
/// </summary>
|
||||
/// <param name="args">The example arguments.</param>
|
||||
void AddExample(string[] args);
|
||||
|
||||
void AddExample(params string[] args);
|
||||
|
||||
/// <summary>
|
||||
/// Adds a command.
|
||||
/// </summary>
|
||||
|
@ -9,7 +9,7 @@ internal sealed class CommandConfigurator : ICommandConfigurator
|
||||
Command = command;
|
||||
}
|
||||
|
||||
public ICommandConfigurator WithExample(string[] args)
|
||||
public ICommandConfigurator WithExample(params string[] args)
|
||||
{
|
||||
Command.Examples.Add(args);
|
||||
return this;
|
||||
|
@ -20,7 +20,7 @@ internal sealed class Configurator : IUnsafeConfigurator, IConfigurator, IConfig
|
||||
Examples = new List<string[]>();
|
||||
}
|
||||
|
||||
public void AddExample(string[] args)
|
||||
public void AddExample(params string[] args)
|
||||
{
|
||||
Examples.Add(args);
|
||||
}
|
||||
|
Reference in New Issue
Block a user