chore: merge CommandArgType into CommandArgSpec
This commit is contained in:
@@ -7,7 +7,7 @@ public sealed class ClearCommand : ICommand
|
|||||||
{
|
{
|
||||||
public string Name => "clear";
|
public string Name => "clear";
|
||||||
public string Description => "Clears the console output.";
|
public string Description => "Clears the console output.";
|
||||||
public IReadOnlyList<CommandArgSpec> Args { get; } = new CommandArgsBuilder().Build();
|
public IReadOnlyList<CommandArgSpec> Args { get; } = [];
|
||||||
|
|
||||||
public CommandResult Execute(CommandArgValues args) => CommandResult.Ok(clearOutput: true);
|
public CommandResult Execute(CommandArgValues args) => CommandResult.Ok(clearOutput: true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ public sealed class HelpCommand(ICommandRegistry registry) : ICommand
|
|||||||
{
|
{
|
||||||
public string Name => "help";
|
public string Name => "help";
|
||||||
public string Description => "Lists all available commands.";
|
public string Description => "Lists all available commands.";
|
||||||
public IReadOnlyList<CommandArgSpec> Args { get; } = new CommandArgsBuilder().Build();
|
public IReadOnlyList<CommandArgSpec> Args { get; } = [];
|
||||||
|
|
||||||
private static string FormatUsage(ICommand command)
|
private static string FormatUsage(ICommand command)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,6 +2,15 @@ using System.Collections.Generic;
|
|||||||
|
|
||||||
namespace Game.Features.Console.Contracts;
|
namespace Game.Features.Console.Contracts;
|
||||||
|
|
||||||
|
public enum CommandArgType
|
||||||
|
{
|
||||||
|
String,
|
||||||
|
Int,
|
||||||
|
Float,
|
||||||
|
Bool,
|
||||||
|
Choice
|
||||||
|
}
|
||||||
|
|
||||||
public sealed record CommandArgSpec(string Name, CommandArgType Type, IReadOnlyList<string> Choices = null)
|
public sealed record CommandArgSpec(string Name, CommandArgType Type, IReadOnlyList<string> Choices = null)
|
||||||
{
|
{
|
||||||
public override string ToString() =>
|
public override string ToString() =>
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
namespace Game.Features.Console.Contracts;
|
|
||||||
|
|
||||||
public enum CommandArgType
|
|
||||||
{
|
|
||||||
String,
|
|
||||||
Int,
|
|
||||||
Float,
|
|
||||||
Bool,
|
|
||||||
Choice
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
uid://dnt7hwlwqtdyq
|
|
||||||
Reference in New Issue
Block a user