feat: add console command framework
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Game.Features.Console.Contracts;
|
||||
|
||||
public sealed class CommandArgsBuilder
|
||||
{
|
||||
private readonly List<CommandArgSpec> _specs = [];
|
||||
|
||||
public CommandArgsBuilder AddStringArg(string name)
|
||||
{
|
||||
_specs.Add(new CommandArgSpec(name, CommandArgType.String));
|
||||
return this;
|
||||
}
|
||||
|
||||
public CommandArgsBuilder AddIntArg(string name)
|
||||
{
|
||||
_specs.Add(new CommandArgSpec(name, CommandArgType.Int));
|
||||
return this;
|
||||
}
|
||||
|
||||
public CommandArgsBuilder AddFloatArg(string name)
|
||||
{
|
||||
_specs.Add(new CommandArgSpec(name, CommandArgType.Float));
|
||||
return this;
|
||||
}
|
||||
|
||||
public CommandArgsBuilder AddBoolArg(string name)
|
||||
{
|
||||
_specs.Add(new CommandArgSpec(name, CommandArgType.Bool));
|
||||
return this;
|
||||
}
|
||||
|
||||
public CommandArgsBuilder AddChoiceArg(string name, IReadOnlyList<string> choices)
|
||||
{
|
||||
_specs.Add(new CommandArgSpec(name, CommandArgType.Choice, choices));
|
||||
return this;
|
||||
}
|
||||
|
||||
public IReadOnlyList<CommandArgSpec> Build() => _specs.ToArray();
|
||||
}
|
||||
Reference in New Issue
Block a user