| 155 | char const* kPositional[] = {"bucket", "object", "destination"}; |
| 156 | |
| 157 | [[noreturn]] void usage(std::string const& argv0, |
| 158 | po::options_description const& desc, |
| 159 | std::string const& message = {}) { |
| 160 | auto exit_status = EXIT_SUCCESS; |
| 161 | if (not message.empty()) { |
| 162 | exit_status = EXIT_FAILURE; |
| 163 | std::cout << "Error: " << message << "\n"; |
| 164 | } |
| 165 | |
| 166 | // format positional args |
| 167 | auto const positional_names = |
| 168 | std::accumulate(std::begin(kPositional), std::end(kPositional), |
| 169 | std::string{" [options]"}, [](auto a, auto const& b) { |
| 170 | a += ' '; |
| 171 | a += b; |
| 172 | return a; |
| 173 | }); |
| 174 | |
| 175 | // print usage + options help, and exit normally |
| 176 | std::cout << "usage: " << argv0 << positional_names << "\n\n" << desc << "\n"; |
| 177 | std::exit(exit_status); |
| 178 | } |
| 179 | |
| 180 | po::variables_map parse_command_line(int argc, char* argv[]) { |
| 181 | auto const default_minimum_slice_size = 64 * 1024 * 1024L; |
no outgoing calls
no test coverage detected