Closed BlackDragonBE closed 5 years ago
For example:
I have this:
[ArgRequired(PromptIfMissing = false), ArgShortcut("u"), ArgDescription("Upload images to WordPress and replace links in files? (true/false)")] public bool UploadImages { get; set; }
I want to have the following arguments to be required only when the above is true:
[ArgRequired(PromptIfMissing = true,If = "UploadImages"), ArgShortcut("user"), ArgDescription("Username")] public string Username { get; set; } [ArgRequired(PromptIfMissing = true,If = "UploadImages"), ArgShortcut("pw"), ArgDescription("Password")] public string Password { get; set; }
Is there a way to do that? Something like ArgRequired(IfValueOf("UploadImages", "True")) would be ideal, but if there's another way, I'd love to hear it. Currently it prompts even if UploadImages is set to false.
Thanks in advance! Cheers
You could implement a custom validator or a custom hook.
For example:
I have this:
I want to have the following arguments to be required only when the above is true:
Is there a way to do that? Something like ArgRequired(IfValueOf("UploadImages", "True")) would be ideal, but if there's another way, I'd love to hear it. Currently it prompts even if UploadImages is set to false.
Thanks in advance! Cheers