Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tlogik validationsamle bugfix #551

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/samples/validation/attributes/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class AttributeProgram

[Option]
[AllowedValues("low", "normal", "high", IgnoreCase = true)]
public string Importance { get; } = "normal";
public string v { get; } = "normal";

[Option(Description = "The colors should be red or blue")]
[RedOrBlue]
Expand All @@ -50,6 +50,7 @@ private void OnExecute()
Console.WriteLine("To = " + To);
Console.WriteLine("Message = " + Message);
Console.WriteLine("Attachments = " + string.Join(", ", Attachments));
Console.WriteLine("Importance = " + Importance);
if (MaxSize.HasValue)
{
Console.WriteLine("Max size = " + MaxSize.Value);
Expand Down
3 changes: 2 additions & 1 deletion docs/samples/validation/builder-api/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public static int Main(string[] args)
.Accepts(v => v.ExistingFile());

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

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