Set an alias for the app
| 4888 | |
| 4889 | /// Set an alias for the app |
| 4890 | App *alias(std::string app_name) { |
| 4891 | if (!detail::valid_name_string(app_name)) { |
| 4892 | throw(IncorrectConstruction("alias is not a valid name string")); |
| 4893 | } |
| 4894 | |
| 4895 | if (parent_ != nullptr) { |
| 4896 | aliases_.push_back(app_name); |
| 4897 | auto &res = _compare_subcommand_names(*this, *_get_fallthrough_parent()); |
| 4898 | if (!res.empty()) { |
| 4899 | aliases_.pop_back(); |
| 4900 | throw(OptionAlreadyAdded("alias already matches an existing subcommand: " + app_name)); |
| 4901 | } |
| 4902 | } else { |
| 4903 | aliases_.push_back(app_name); |
| 4904 | } |
| 4905 | |
| 4906 | return this; |
| 4907 | } |
| 4908 | |
| 4909 | /// Remove the error when extras are left over on the command line. |
| 4910 | App *allow_extras(bool allow = true) { |
nothing calls this directly
no test coverage detected