(ws) have more subcommand handle --pidfile, to write pid to a file

This commit is contained in:
Benjamin Sergeant 2020-08-14 15:09:12 -07:00
parent 53575f8d90
commit 5423a31d5a

View File

@ -189,6 +189,10 @@ int main(int argc, char** argv)
uint32_t maxWaitBetweenReconnectionRetries; uint32_t maxWaitBetweenReconnectionRetries;
int pingIntervalSecs = 30; int pingIntervalSecs = 30;
auto addGenericOptions = [&pidfile](CLI::App* app) {
app->add_option("--pidfile", pidfile, "Pid file");
};
auto addTLSOptions = [&tlsOptions, &verifyNone](CLI::App* app) { auto addTLSOptions = [&tlsOptions, &verifyNone](CLI::App* app) {
app->add_option( app->add_option(
"--cert-file", tlsOptions.certFile, "Path to the (PEM format) TLS cert file") "--cert-file", tlsOptions.certFile, "Path to the (PEM format) TLS cert file")
@ -239,8 +243,8 @@ int main(int argc, char** argv)
sendApp->add_option("path", path, "Path to the file to send") sendApp->add_option("path", path, "Path to the file to send")
->required() ->required()
->check(CLI::ExistingPath); ->check(CLI::ExistingPath);
sendApp->add_option("--pidfile", pidfile, "Pid file");
sendApp->add_flag("-x", disablePerMessageDeflate, "Disable per message deflate"); sendApp->add_flag("-x", disablePerMessageDeflate, "Disable per message deflate");
addGenericOptions(sendApp);
addTLSOptions(sendApp); addTLSOptions(sendApp);
CLI::App* receiveApp = app.add_subcommand("receive", "Receive a file"); CLI::App* receiveApp = app.add_subcommand("receive", "Receive a file");
@ -272,6 +276,7 @@ int main(int argc, char** argv)
"Max Wait Time between reconnection retries"); "Max Wait Time between reconnection retries");
connectApp->add_option("--ping_interval", pingIntervalSecs, "Interval between sending pings"); connectApp->add_option("--ping_interval", pingIntervalSecs, "Interval between sending pings");
connectApp->add_option("--subprotocol", subprotocol, "Subprotocol"); connectApp->add_option("--subprotocol", subprotocol, "Subprotocol");
addGenericOptions(connectApp);
addTLSOptions(connectApp); addTLSOptions(connectApp);
CLI::App* echoClientApp = CLI::App* echoClientApp =
@ -301,6 +306,7 @@ int main(int argc, char** argv)
echoServerApp->add_flag("-6", ipv6, "IpV6"); echoServerApp->add_flag("-6", ipv6, "IpV6");
echoServerApp->add_flag("-x", disablePerMessageDeflate, "Disable per message deflate"); echoServerApp->add_flag("-x", disablePerMessageDeflate, "Disable per message deflate");
echoServerApp->add_flag("-p", disablePong, "Disable sending PONG in response to PING"); echoServerApp->add_flag("-p", disablePong, "Disable sending PONG in response to PING");
addGenericOptions(echoServerApp);
addTLSOptions(echoServerApp); addTLSOptions(echoServerApp);
CLI::App* pushServerApp = app.add_subcommand("push_server", "Push server"); CLI::App* pushServerApp = app.add_subcommand("push_server", "Push server");
@ -482,6 +488,7 @@ int main(int argc, char** argv)
proxyServerApp->add_flag("-v", verbose, "Verbose"); proxyServerApp->add_flag("-v", verbose, "Verbose");
proxyServerApp->add_option("--config_path", configPath, "Path to config data") proxyServerApp->add_option("--config_path", configPath, "Path to config data")
->check(CLI::ExistingPath); ->check(CLI::ExistingPath);
addGenericOptions(proxyServerApp);
addTLSOptions(proxyServerApp); addTLSOptions(proxyServerApp);
CLI::App* minidumpApp = app.add_subcommand("upload_minidump", "Upload a minidump to sentry"); CLI::App* minidumpApp = app.add_subcommand("upload_minidump", "Upload a minidump to sentry");