| 7900 | } |
| 7901 | |
| 7902 | inline std::string Formatter::make_description(const App *app) const { |
| 7903 | std::string desc = app->get_description(); |
| 7904 | auto min_options = app->get_require_option_min(); |
| 7905 | auto max_options = app->get_require_option_max(); |
| 7906 | if (app->get_required()) { |
| 7907 | desc += " REQUIRED "; |
| 7908 | } |
| 7909 | if ((max_options == min_options) && (min_options > 0)) { |
| 7910 | if (min_options == 1) { |
| 7911 | desc += " \n[Exactly 1 of the following options is required]"; |
| 7912 | } else { |
| 7913 | desc += " \n[Exactly " + std::to_string(min_options) + "options from the following list are required]"; |
| 7914 | } |
| 7915 | } else if (max_options > 0) { |
| 7916 | if (min_options > 0) { |
| 7917 | desc += " \n[Between " + std::to_string(min_options) + " and " + std::to_string(max_options) + |
| 7918 | " of the follow options are required]"; |
| 7919 | } else { |
| 7920 | desc += " \n[At most " + std::to_string(max_options) + " of the following options are allowed]"; |
| 7921 | } |
| 7922 | } else if (min_options > 0) { |
| 7923 | desc += " \n[At least " + std::to_string(min_options) + " of the following options are required]"; |
| 7924 | } |
| 7925 | return (!desc.empty()) ? desc + "\n" : std::string{}; |
| 7926 | } |
| 7927 | |
| 7928 | inline std::string Formatter::make_usage(const App *app, std::string name) const { |
| 7929 | std::stringstream out; |
nothing calls this directly
no test coverage detected