-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathOverrideArgumentParserAttribute.cs
More file actions
32 lines (30 loc) · 1.29 KB
/
OverrideArgumentParserAttribute.cs
File metadata and controls
32 lines (30 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using System;
using Ultz.Extensions.Commands.Built;
using Ultz.Extensions.Commands.Parsing.ArgumentParsers;
namespace Ultz.Extensions.Commands.Attributes
{
/// <summary>
/// Overrides the argument parser for the <see cref="Module" /> or <see cref="Command" />.
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)]
public class OverrideArgumentParserAttribute : Attribute
{
/// <summary>
/// Initialises a new <see cref="OverrideArgumentParserAttribute" /> with the specified <see cref="Type" /> of a custom
/// <see cref="IArgumentParser" />.
/// </summary>
/// <param name="customArgumentParserType"> The <see cref="Type" /> to override with. </param>
/// <exception cref="ArgumentNullException">
/// Custom argument parser type must not be null.
/// </exception>
public OverrideArgumentParserAttribute(Type customArgumentParserType)
{
Value = customArgumentParserType ?? throw new ArgumentNullException(nameof(customArgumentParserType),
"Custom type parser type must not be null.");
}
/// <summary>
/// Gets the <see cref="Type" /> of the custom type parser.
/// </summary>
public Type Value { get; }
}
}