Add ability to pass example args using params syntax (#1166)

This commit is contained in:
Andrii Rublov
2023-05-12 04:08:42 -07:00
committed by GitHub
parent dac2097321
commit 404b052a5f
6 changed files with 18 additions and 20 deletions

View File

@ -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.

View File

@ -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>

View File

@ -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;

View File

@ -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);
}