You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
moh-hassan edited this page Feb 2, 2020
·
2 revisions
You can define options as belonging to a group. An option group represents a group of options which are optional, but at least one should be available.
You can provide values to all options in a group. If none of the options belonging to a group have value, you will get an error.
You can define more than one option group.
NOTE: Required rules are ignored if an option belongs to an option group. If an options is marked as Required, it will not be treated as required and the Required label will not appear in help text.
Group options in different option groip by defining the options class as follows:
classAppendToFileNameOptions{//define commands in set(group) named fetch[Option(Group="append",HelpText="Prefix to append to file name")]publicstringPrefix{get;set;}[Option(Group="append",HelpText="Suffix to append to file name")]publicstringSuffix{get;set;}[Option("source",HelpText="The path of a file to rename")]publicstringFilePath{get;set;}}
This will produce MissingGroupOptionError containing the group name and the option names which belong to this group
Help text
Consider the options scenario above. Group name will be rendered as part of the help text before the option help text
Myapp 2.0.0-beta
Copyright (c) 2019 Global.com
--source Required. The path of a file to rename
--prefix (Group: append) Prefix to append to file name
--suffix (Group: append) Suffix to append to file name
Remarks
The Group options are available in v2.7+
Both SetName and Group are not applicable to the option at the same time. Only SetName OR Group can be applied on the option.