MCPcopy Create free account
hub / github.com/Tencent/TAD_Sim / make_description

Method make_description

simcore/framework/src/cli/cli.hpp:7902–7926  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7900}
7901
7902inline 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
7928inline std::string Formatter::make_usage(const App *app, std::string name) const {
7929 std::stringstream out;

Callers

nothing calls this directly

Calls 6

to_stringFunction · 0.85
get_descriptionMethod · 0.45
get_requiredMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected