mirror of
https://github.com/Tyrrrz/CliFx.git
synced 2025-10-25 15:19:17 +00:00
45 lines
1.3 KiB
C#
45 lines
1.3 KiB
C#
using System.Collections.Generic;
|
|
using CliFx.Domain;
|
|
|
|
namespace CliFx.Tests.Internal
|
|
{
|
|
internal class CommandInputBuilder
|
|
{
|
|
private readonly List<CommandDirectiveInput> _directives = new List<CommandDirectiveInput>();
|
|
private readonly List<CommandParameterInput> _parameters = new List<CommandParameterInput>();
|
|
private readonly List<CommandOptionInput> _options = new List<CommandOptionInput>();
|
|
|
|
private string? _commandName;
|
|
|
|
public CommandInputBuilder SetCommandName(string commandName)
|
|
{
|
|
_commandName = commandName;
|
|
return this;
|
|
}
|
|
|
|
public CommandInputBuilder AddDirective(string directive)
|
|
{
|
|
_directives.Add(new CommandDirectiveInput(directive));
|
|
return this;
|
|
}
|
|
|
|
public CommandInputBuilder AddParameter(string parameter)
|
|
{
|
|
_parameters.Add(new CommandParameterInput(parameter));
|
|
return this;
|
|
}
|
|
|
|
public CommandInputBuilder AddOption(string alias, params string[] values)
|
|
{
|
|
_options.Add(new CommandOptionInput(alias, values));
|
|
return this;
|
|
}
|
|
|
|
public CommandInput Build() => new CommandInput(
|
|
_directives,
|
|
_commandName,
|
|
_parameters,
|
|
_options
|
|
);
|
|
}
|
|
} |