Добавьте файлы проекта.

This commit is contained in:
2025-11-27 09:10:58 +03:00
parent 730fd30d87
commit c1f50fcca0
32 changed files with 1154 additions and 0 deletions

View File

@@ -0,0 +1,49 @@
namespace ArgumentsToolkit;
/// <summary>
/// Атрибут для описания параметра командной строки.
/// Позволяет задать имя, короткое имя, описание, обязательность и значение по умолчанию.
/// </summary>
[AttributeUsage(AttributeTargets.Property)]
public class OptionAttribute : Attribute
{
/// <summary>
/// Поолное название для --Name
/// </summary>
public string Name { get; }
/// <summary>
/// Краткое название для -ShortName
/// </summary>
public string? ShortName { get; }
/// <summary>
/// Описание параметра
/// </summary>
public string? Description { get; }
/// <summary>
/// Обязательный параметр
/// </summary>
public bool Required { get; }
/// <summary>
/// Значение по умолчанию
/// </summary>
public object? DefaultValue { get; }
public OptionAttribute(
string name,
string? shortName = null,
string? description = null,
bool required = false,
object? defaultValue = null
)
{
Name = name ?? throw new ArgumentNullException(nameof(name));
ShortName = shortName;
Description = description;
Required = required;
DefaultValue = defaultValue;
}
}

View File

@@ -0,0 +1,15 @@
namespace ArgumentsToolkit;
/// <summary>
/// Атрибут для указания кастомного конвертера для свойства.
/// </summary>
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
public sealed class OptionConverterAttribute : Attribute
{
public Type ConverterType { get; }
public OptionConverterAttribute(Type converterType)
{
ConverterType = converterType;
}
}