Skip to content

Commit 1b9c558

Browse files
committed
Rename to AllowedValuesAttribute
1 parent bb2e18f commit 1b9c558

File tree

6 files changed

+14
-13
lines changed

6 files changed

+14
-13
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ New features:
99
- Add the `[FileOrDirectoryExists]` attribute
1010
- Add the `[DirectoryExists]` attribute
1111
- Add the `[LegalFilePath]` attribute
12-
- Add the `[Values]` attribute
12+
- Add the `[AllowedValues]` attribute
1313
- Added a new, fluent API for validation.
1414
- Added `Option().Accepts()` and `Argument().Accepts()`
1515
- Add `.ExistingFile()`

CommandLineUtils.sln

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Microsoft Visual Studio Solution File, Format Version 12.00
22
# Visual Studio 15
3-
VisualStudioVersion = 15.0.27130.2010
3+
VisualStudioVersion = 15.0.27130.2026
44
MinimumVisualStudioVersion = 15.0.26124.0
55
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{95D4B35E-0A21-4D64-8BAF-27DD6C019FC5}"
66
EndProject
@@ -25,6 +25,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "files", "files", "{509D6286
2525
.licenseheader = .licenseheader
2626
build.cmd = build.cmd
2727
build.ps1 = build.ps1
28+
CHANGELOG.md = CHANGELOG.md
2829
Directory.Build.props = Directory.Build.props
2930
Directory.Build.targets = Directory.Build.targets
3031
LICENSE.txt = LICENSE.txt

samples/Validation/Attributes.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class AttributeProgram
2828
public string[] Attachments { get; }
2929

3030
[Option]
31-
[Values("low", "normal", "high", Comparer = StringComparison.OrdinalIgnoreCase)]
31+
[AllowedValues("low", "normal", "high", Comparer = StringComparison.OrdinalIgnoreCase)]
3232
public string Importance { get; }
3333

3434
[Option(Description = "The colors should be red or blue")]

src/CommandLineUtils/Attributes/ValuesAttribute.cs renamed to src/CommandLineUtils/Attributes/AllowedValuesAttribute.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,25 @@ namespace McMaster.Extensions.CommandLineUtils
1515
/// </para>
1616
/// </summary>
1717
[AttributeUsage(AttributeTargets.Property)]
18-
public sealed class ValuesAttribute : ValidationAttribute
18+
public sealed class AllowedValuesAttribute : ValidationAttribute
1919
{
2020
private readonly string[] _allowedValues;
2121

2222
/// <summary>
23-
/// Initializes an instance of <see cref="ValuesAttribute"/>.
23+
/// Initializes an instance of <see cref="AllowedValuesAttribute"/>.
2424
/// </summary>
2525
/// <param name="allowedValues"></param>
26-
public ValuesAttribute(params string[] allowedValues)
26+
public AllowedValuesAttribute(params string[] allowedValues)
2727
: this(StringComparison.CurrentCulture, allowedValues)
2828
{
2929
}
3030

3131
/// <summary>
32-
/// Initializes an instance of <see cref="ValuesAttribute"/>.
32+
/// Initializes an instance of <see cref="AllowedValuesAttribute"/>.
3333
/// </summary>
3434
/// <param name="comparer"></param>
3535
/// <param name="allowedValues"></param>
36-
public ValuesAttribute(StringComparison comparer, params string[] allowedValues)
36+
public AllowedValuesAttribute(StringComparison comparer, params string[] allowedValues)
3737
: base(GetDefaultError(allowedValues))
3838
{
3939
_allowedValues = allowedValues ?? new string[0];

src/CommandLineUtils/Validation/ValidationExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public static IValidationBuilder Values(this IValidationBuilder builder, bool ig
160160
/// <returns>The builder.</returns>
161161
public static IValidationBuilder Values(this IValidationBuilder builder, StringComparison comparer, params string[] allowedValues)
162162
{
163-
return builder.Satisfies<ValuesAttribute>(ctorArgs: new object[] { comparer, allowedValues });
163+
return builder.Satisfies<AllowedValuesAttribute>(ctorArgs: new object[] { comparer, allowedValues });
164164
}
165165

166166
/// <summary>

test/CommandLineUtils.Tests/ValueAttributeTests.cs renamed to test/CommandLineUtils.Tests/AllowedValuesAttributeTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@
66

77
namespace McMaster.Extensions.CommandLineUtils.Tests
88
{
9-
public class ValueAttributeTests
9+
public class AllowedValuesAttributeTests
1010
{
1111
private readonly ITestOutputHelper _output;
1212

13-
public ValueAttributeTests(ITestOutputHelper output)
13+
public AllowedValuesAttributeTests(ITestOutputHelper output)
1414
{
1515
_output = output;
1616
}
1717

1818
private class Program
1919
{
2020
[Argument(0)]
21-
[Values("red", "blue", "green")]
21+
[AllowedValues("red", "blue", "green")]
2222
public string Option { get; }
2323

2424
private void OnExecute() { }
@@ -46,7 +46,7 @@ public void ValidatesValueInSet(string value, bool isValid)
4646
private class IgnoreCaseProgram
4747
{
4848
[Argument(0)]
49-
[Values("red", "blue", "green", IgnoreCase = true)]
49+
[AllowedValues("red", "blue", "green", IgnoreCase = true)]
5050
public string Option { get; }
5151

5252
private void OnExecute() { }

0 commit comments

Comments
 (0)