| 332 | } |
| 333 | |
| 334 | std::string CommandLine::usage(const Command* c) const |
| 335 | { |
| 336 | std::ostringstream oss; |
| 337 | |
| 338 | oss << "\n" |
| 339 | << "Usage:\n"; |
| 340 | |
| 341 | if (c) { |
| 342 | oss << " ModOrganizer.exe [global-options] " << c->usageLine() << "\n\n"; |
| 343 | |
| 344 | const std::string more = c->moreInfo(); |
| 345 | if (!more.empty()) { |
| 346 | oss << more << "\n\n"; |
| 347 | } |
| 348 | |
| 349 | oss << "Command options:\n" << c->visibleOptions() << "\n"; |
| 350 | } else { |
| 351 | oss << " ModOrganizer.exe [options] [[command] [command-options]]\n" |
| 352 | << "\n" |
| 353 | << "Commands:\n"; |
| 354 | |
| 355 | // name and description for all commands |
| 356 | std::vector<std::pair<std::string, std::string>> v; |
| 357 | for (auto&& c : m_commands) { |
| 358 | // don't show legacy commands |
| 359 | if (c->legacy()) { |
| 360 | continue; |
| 361 | } |
| 362 | |
| 363 | v.push_back({c->name(), c->description()}); |
| 364 | } |
| 365 | |
| 366 | oss << table(v, 2, 4) << "\n" |
| 367 | << "\n"; |
| 368 | } |
| 369 | |
| 370 | oss << "Global options:\n" << m_visibleOptions << "\n"; |
| 371 | |
| 372 | // show the more text unless this is usage for a specific command |
| 373 | if (!c) { |
| 374 | oss << "\n" << more() << "\n"; |
| 375 | } |
| 376 | |
| 377 | return oss.str(); |
| 378 | } |
| 379 | |
| 380 | bool CommandLine::pick() const |
| 381 | { |
nothing calls this directly
no test coverage detected