Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions Remora.Commands/Builders/CommandParameterBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,8 @@ public CommandParameterBuilder(CommandBuilder builder, Type type)
{
_name = string.Empty;
_builder = builder;
_attributes = new();
_conditions = new();
builder.Parameters.Add(this);

_attributes = [];
_conditions = [];
_parameterType = type;
}

Expand Down
28 changes: 14 additions & 14 deletions Tests/Remora.Commands.Tests/Builders/CommandBuilderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ public void CanBuildParameterizedCommand()
var commandBuilder = new CommandBuilder()
.WithName("test")
.WithInvocation((_, _, _) => default)
.WithDescription("A test command.");

_ = new CommandParameterBuilder(commandBuilder, typeof(string))
.WithName("test")
.WithDescription("A test parameter.");
.WithDescription("A test command.")
.AddParameter(typeof(string))
.WithName("test")
.WithDescription("A test parameter.")
.Finish();

var command = commandBuilder.Build(rootNode);

Expand All @@ -90,15 +90,15 @@ public void CanBuildParameterizedCommandWithMultipleParameters()
var commandBuilder = new CommandBuilder()
.WithName("test")
.WithInvocation((_, _, _) => default)
.WithDescription("A test command.");

_ = new CommandParameterBuilder(commandBuilder, typeof(string))
.WithName("test")
.WithDescription("A test parameter.");

_ = new CommandParameterBuilder(commandBuilder, typeof(int))
.WithName("test2")
.WithDescription("A second test parameter.");
.WithDescription("A test command.")
.AddParameter(typeof(string))
.WithName("test")
.WithDescription("A test parameter.")
.Finish()
.AddParameter(typeof(int))
.WithName("test2")
.WithDescription("A second test parameter.")
.Finish();

var command = commandBuilder.Build(rootNode);

Expand Down
Loading