diff --git a/README.md b/README.md index c27f0b5..42cccaf 100644 --- a/README.md +++ b/README.md @@ -82,7 +82,7 @@ std::string s; The variable `s` will carry the same value as `string_option.value()`, and thus the declaration of `string_option` can be omitted. -### Visibility of an option +### Attributes of an option Options have an `Attribute`: they can be hidden in the auto-created help message, or classified as "advanced", or "expert": @@ -92,7 +92,7 @@ auto advanced_int = op.add, Attribute::advanced>("i", "integer", "ad auto hidden_bool = op.add("", "hidden", "hidden flag"); ``` -Now `cout << op.help()` (same as `cout << op`) will not show the hidden or advanced option, while `cout << op.help(Visibility::advanced)` will show the advanced option. The hidden one is never shown to the user. +Now `cout << op.help()` (same as `cout << op`) will not show the hidden or advanced option, while `cout << op.help(Attribute::advanced)` will show the advanced option. The hidden one is never shown to the user. Also an option can be flagged as mandatory by assigning `Attribute::required` ## Example @@ -112,16 +112,16 @@ int main(int argc, char **argv) OptionParser op("Allowed options"); auto help_option = op.add("h", "help", "produce help message"); auto verbose_option = op.add("v", "verbose", "be verbose", &v); - auto hidden_option = op.add("x", "", "hidden option"); + auto hidden_option = op.add("x", "", "hidden option"); auto double_option = op.add>("d", "double", "test for double values", 3.14159265359); auto float_option = op.add>("f", "float", "test for float values", 2.71828182845f, &f); op.add>("i", "int", "test for int value w/o option", 23, &i); auto string_option = op.add>("s", "string", "test for string values"); auto implicit_int_option = op.add>("m", "implicit", "implicit test", 42); - auto advanced_option = op.add("", "advanced", "advanced option"); - auto expert_option = op.add("", "expert", "expert option"); + auto advanced_option = op.add("", "advanced", "advanced option"); + auto expert_option = op.add("", "expert", "expert option"); auto inactive_option = op.add("", "inactive", "inactive option"); - inactive_option->set_visibility(Visibility::inactive); + inactive_option->set_attribute(Attribute::inactive); implicit_int_option->assign_to(&m); op.parse(argc, argv); @@ -130,9 +130,9 @@ int main(int argc, char **argv) if (help_option->count() == 1) cout << op << "\n"; else if (help_option->count() == 2) - cout << op.help(Visibility::advanced) << "\n"; + cout << op.help(Attribute::advanced) << "\n"; else if (help_option->count() > 2) - cout << op.help(Visibility::expert) << "\n"; + cout << op.help(Attribute::expert) << "\n"; // show all non option arguments (those without "-o" or "--option") for (const auto& non_option_arg: op.non_option_args())