MCPcopy Create free account
hub / github.com/GoogleCloudPlatform/cpp-samples / usage

Function usage

gcs-fast-transfers/upload.cc:103–124  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

101char const* kPositional[] = {"source", "bucket", "object"};
102
103[[noreturn]] void usage(std::string const& argv0,
104 po::options_description const& desc,
105 std::string const& message = {}) {
106 auto exit_status = EXIT_SUCCESS;
107 if (not message.empty()) {
108 exit_status = EXIT_FAILURE;
109 std::cout << "Error: " << message << "\n";
110 }
111
112 // format positional args
113 auto const positional_names =
114 std::accumulate(std::begin(kPositional), std::end(kPositional),
115 std::string{" [options]"}, [](auto a, auto const& b) {
116 a += ' ';
117 a += b;
118 return a;
119 });
120
121 // print usage + options help, and exit normally
122 std::cout << "usage: " << argv0 << positional_names << "\n\n" << desc << "\n";
123 std::exit(exit_status);
124}
125
126po::variables_map parse_command_line(int argc, char* argv[]) {
127 auto const default_min_stream_size = 64 * 1024 * 1024L;

Callers 1

parse_command_lineFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected