| 80 | |
| 81 | |
| 82 | void SubcommandKernel::outputHelp() |
| 83 | { |
| 84 | auto outputStdOpts = [this]() |
| 85 | { |
| 86 | ProgramArgs args; |
| 87 | addBasicSwitches(args); |
| 88 | |
| 89 | std::cout << "standard options:" << std::endl; |
| 90 | args.dump(std::cout, 2, Utils::screenWidth()); |
| 91 | }; |
| 92 | |
| 93 | auto outputSubOpts = [this](const std::string& sub) |
| 94 | { |
| 95 | ProgramArgs args; |
| 96 | addSubSwitches(args, sub); |
| 97 | |
| 98 | std::cout << "subcommand '" << sub << "' options:" << std::endl; |
| 99 | args.dump(std::cout, 2, Utils::screenWidth()); |
| 100 | }; |
| 101 | |
| 102 | if (Utils::contains(subcommands(), m_subcommand)) |
| 103 | { |
| 104 | // We're repeating addSubSwitches here (it's also called from |
| 105 | // outputSubOpts), but it keeps things cleaner since outputSubOpts |
| 106 | // also writes output. |
| 107 | ProgramArgs args; |
| 108 | addSubSwitches(args, m_subcommand); |
| 109 | |
| 110 | std::cout << "usage: " << "pdal " << getShortName() << " " << |
| 111 | m_subcommand << " [options] " << args.commandLine() << |
| 112 | std::endl; |
| 113 | |
| 114 | outputStdOpts(); |
| 115 | outputSubOpts(m_subcommand); |
| 116 | } |
| 117 | else |
| 118 | { |
| 119 | std::cout << "usage: " << "pdal " << getShortName() << |
| 120 | " <subcommand> [options] " << std::endl; |
| 121 | |
| 122 | outputStdOpts(); |
| 123 | for (const std::string& subcmd : subcommands()) |
| 124 | outputSubOpts(subcmd); |
| 125 | } |
| 126 | |
| 127 | std::cout << "\nFor more information, see the full documentation for " |
| 128 | "PDAL at https://pdal.org/\n" << std::endl; |
| 129 | } |
| 130 | |
| 131 | } // namespace pdal |
| 132 |
nothing calls this directly
no test coverage detected