Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enh(broker): cbd with multiargs and robot tests #306

Merged
merged 5 commits into from
Jun 30, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 34 additions & 33 deletions centreon-broker/core/src/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ static std::atomic_bool gl_term{false};

static struct option long_options[] = {{"pool_size", required_argument, 0, 's'},
{"check", no_argument, 0, 'c'},
{"debug", no_argument, 0, 'd'},
{"diagnose", no_argument, 0, 'D'},
{"version", no_argument, 0, 'v'},
{"help", no_argument, 0, 'h'},
Expand Down Expand Up @@ -155,33 +154,35 @@ int main(int argc, char* argv[]) {
try {
// Check the command line.
bool check(false);
bool debug(false);
bool diagnose(false);
bool help(false);
bool version(false);

opt = getopt_long(argc, argv, "t:cdDvh", long_options, &option_index);
switch (opt) {
case 't':
n_thread = atoi(optarg);
break;
case 'c':
check = true;
break;
case 'd':
debug = true;
break;
case 'D':
diagnose = true;
break;
case 'h':
help = true;
break;
case 'v':
version = true;
break;
default:
break;
while ((opt = getopt_long(argc, argv, "s:cDvh", long_options,
&option_index)) != -1) {
switch (opt) {
case 's':
if (!absl::SimpleAtoi(optarg, &n_thread)) {
throw msg_fmt("The option -s expects a positive integer");
}
break;
case 'c':
check = true;
break;
case 'D':
diagnose = true;
break;
case 'h':
help = true;
break;
case 'v':
version = true;
break;
default:
throw msg_fmt(
"Enter allowed options : [-s <poolsize>] [-c] [-D] [-h] [-v]");
break;
}
}

if (optind < argc)
Expand All @@ -199,14 +200,13 @@ int main(int argc, char* argv[]) {
diag.generate(gl_mainconfigfiles);
} else if (help) {
log_v2::core()->info(
"USAGE: {} [-t] [-c] [-d] [-D] [-h] [-v] [<configfile>]", argv[0]);

log_v2::core()->info(" -t Set x threads.");
log_v2::core()->info(" -c Check configuration file.");
log_v2::core()->info(" -d Enable debug mode.");
log_v2::core()->info(" -D Generate a diagnostic file.");
log_v2::core()->info(" -h Print this help.");
log_v2::core()->info(" -v Print Centreon Broker version.");
"USAGE: {} [-s <poolsize>] [-c] [-D] [-h] [-v] [<configfile>]",
argv[0]);
log_v2::core()->info(" '-s<poolsize>' Set poolsize threads.");
log_v2::core()->info(" '-c' Check configuration file.");
log_v2::core()->info(" '-D' Generate a diagnostic file.");
log_v2::core()->info(" '-h' Print this help.");
log_v2::core()->info(" '-v' Print Centreon Broker version.");
log_v2::core()->info("Centreon Broker {}", CENTREON_BROKER_VERSION);
log_v2::core()->info("Copyright 2009-2021 Centreon");
log_v2::core()->info(
Expand All @@ -217,7 +217,8 @@ int main(int argc, char* argv[]) {
retval = 0;
} else if (gl_mainconfigfiles.empty()) {
log_v2::core()->error(
"USAGE: {} [-c] [-d] [-D] [-h] [-v] [<configfile>]\n\n", argv[0]);
"USAGE: {} [-s <poolsize>] [-c] [-D] [-h] [-v] [<configfile>]\n\n",
argv[0]);
return 1;
} else {
log_v2::core()->info("Centreon Broker {}", CENTREON_BROKER_VERSION);
Expand Down
Loading