Keep the pre-Examples descriptor constructors as forwarding overloads

This commit is contained in:
dualfroz committed 2026-09-23 06:17:56 +02:00
1 parent 5e1eff9f24
commit 535f085d6b
1 file changed
+24 -1
+24 -1
View File
@@ -50,6 +50,18 @@ public class CommandDescriptor(
? string.Equals(name, Name, StringComparison.OrdinalIgnoreCase)
: string.IsNullOrWhiteSpace(name);
/// <summary>
/// Initializes an instance of <see cref="CommandDescriptor" /> without examples.
/// </summary>
public CommandDescriptor(
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)]
Type type,
string? name,
string? description,
IReadOnlyList<CommandInputDescriptor> inputs
)
: this(type, name, description, Array.Empty<string>(), inputs) { }
/// <inheritdoc />
public override string ToString() => !string.IsNullOrWhiteSpace(Name) ? Name : "<default>";
}
@@ -67,4 +79,15 @@ public class CommandDescriptor<
IReadOnlyList<string> examples,
IReadOnlyList<CommandInputDescriptor> inputs
) : CommandDescriptor(typeof(TCommand), name, description, examples, inputs)
where TCommand : ICommand;
where TCommand : ICommand
{
/// <summary>
/// Initializes an instance of <see cref="CommandDescriptor{TCommand}" /> without examples.
/// </summary>
public CommandDescriptor(
string? name,
string? description,
IReadOnlyList<CommandInputDescriptor> inputs
)
: this(name, description, Array.Empty<string>(), inputs) { }
}