Parse command-line args (#26161)

pull/26168/head
Yash Tibrewal 4 years ago committed by GitHub
parent 1c49176a24
commit a8ebadbe5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      examples/cpp/helloworld/BUILD
  2. 2
      examples/cpp/helloworld/xds_greeter_client.cc
  3. 2
      examples/cpp/helloworld/xds_greeter_server.cc

@ -52,6 +52,7 @@ cc_binary(
"//:grpc++",
"//examples/protos:helloworld_cc_grpc",
"@com_google_absl//absl/flags:flag",
"@com_google_absl//absl/flags:parse",
],
)
@ -86,5 +87,6 @@ cc_binary(
"//:grpcpp_admin",
"//examples/protos:helloworld_cc_grpc",
"@com_google_absl//absl/flags:flag",
"@com_google_absl//absl/flags:parse",
],
)

@ -21,6 +21,7 @@
#include <string>
#include "absl/flags/flag.h"
#include "absl/flags/parse.h"
#include <grpcpp/grpcpp.h>
@ -77,6 +78,7 @@ class GreeterClient {
};
int main(int argc, char** argv) {
absl::ParseCommandLine(argc, argv);
GreeterClient greeter(grpc::CreateChannel(
absl::GetFlag(FLAGS_target), absl::GetFlag(FLAGS_secure)
? grpc::experimental::XdsCredentials(

@ -21,6 +21,7 @@
#include <string>
#include "absl/flags/flag.h"
#include "absl/flags/parse.h"
#include "absl/strings/str_cat.h"
#include <grpcpp/ext/admin_services.h>
@ -101,6 +102,7 @@ void RunServer() {
}
int main(int argc, char** argv) {
absl::ParseCommandLine(argc, argv);
RunServer();
return 0;
}

Loading…
Cancel
Save