| 149 | } |
| 150 | |
| 151 | void CommandLine::PrintUsage() { |
| 152 | for (auto &error: _errors) { |
| 153 | std::cerr << error << std::endl; |
| 154 | } |
| 155 | std::cerr << std::endl; |
| 156 | |
| 157 | std::cerr << _usage << std::endl; |
| 158 | for (auto &target: _targets) { |
| 159 | std::cerr << util::format("{}:", target.first) << std::endl; |
| 160 | auto &options = target.second; |
| 161 | for (auto &it: options._shortMap) { |
| 162 | auto &shortName = it.first; |
| 163 | auto &name = it.second; |
| 164 | auto &option = options._args[name]; |
| 165 | |
| 166 | std::cerr << util::format("\t-{} --{}\n\t\t{}", |
| 167 | shortName, name, option.Description) |
| 168 | << std::endl; |
| 169 | std::cerr << std::endl; |
| 170 | } |
| 171 | } |
| 172 | } |