Skip to content

Commit 210871a

Browse files
tlogiknatemcmaster
andauthored
docs: fix incorrect validation example (#551)
The documented use of Accepts was incorrect and has been corrected [ci skip] --------- Co-authored-by: Nate McMaster <nate.mcmaster@gmail.com>
1 parent d463a5c commit 210871a

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

docs/samples/validation/attributes/Program.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ private void OnExecute()
5050
Console.WriteLine("To = " + To);
5151
Console.WriteLine("Message = " + Message);
5252
Console.WriteLine("Attachments = " + string.Join(", ", Attachments));
53+
Console.WriteLine("Importance = " + Importance);
5354
if (MaxSize.HasValue)
5455
{
5556
Console.WriteLine("Max size = " + MaxSize.Value);

docs/samples/validation/builder-api/Program.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public static int Main(string[] args)
2727
.Accepts(v => v.ExistingFile());
2828

2929
var importance = app.Option("-i|--importance <IMPORTANCE>", "Low, medium or high", CommandOptionType.SingleValue)
30-
.Accepts().Values("low", "medium", "high");
30+
.Accepts(v => v.Values("low", "medium", "high"));
3131

3232
var optionColor = app.Option("--color <COLOR>", "The color. Should be 'red' or 'blue'.", CommandOptionType.SingleValue);
3333
optionColor.Validators.Add(new MustBeBlueOrRedValidator());
@@ -41,6 +41,7 @@ public static int Main(string[] args)
4141
Console.WriteLine("To = " + optionReceiver.Value());
4242
Console.WriteLine("Message = " + optionMessage.Value());
4343
Console.WriteLine("Attachments = " + string.Join(", ", attachments.Values));
44+
Console.WriteLine("Importance = " + importance.Value());
4445
if (optionMaxSize.HasValue())
4546
{
4647
Console.WriteLine("Max size = " + optionMaxSize.ParsedValue);

0 commit comments

Comments
 (0)