'Link options with specified commands in CLI tool
how do I Link options with Specidied commands I need to make sure certain options are only required with certain commands. for example: suppose i have two commands add and remove and the following options.
[Option("name", Required = true, HelpText = "name of the person")]
public string? name { get; set; }
[Option("place", Required = true, HelpText = "place of the person")]
public string? place { get; set; }
now, options --name and --place is required with add command only, while for remove only --name is mandatory.
PROBLEM: currently it asks me to enter both --name and --place for all the commands.
One way is to make required as false for both and check if the user inputs it or not, and throw error if required options are not provided, but is there any other way to directly link it to commands.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
