()
| 256 | |
| 257 | |
| 258 | def main(): |
| 259 | parser = argparse.ArgumentParser(description=__doc__) |
| 260 | parser.add_argument( |
| 261 | "--clang-format-executable", |
| 262 | metavar="EXECUTABLE", |
| 263 | help="path to the clang-format executable", |
| 264 | default="clang-format", |
| 265 | ) |
| 266 | parser.add_argument( |
| 267 | "--extensions", |
| 268 | help="comma separated list of file extensions (default: {})".format( |
| 269 | DEFAULT_EXTENSIONS |
| 270 | ), |
| 271 | default=DEFAULT_EXTENSIONS, |
| 272 | ) |
| 273 | parser.add_argument( |
| 274 | "-r", |
| 275 | "--recursive", |
| 276 | action="store_true", |
| 277 | help="run recursively over directories", |
| 278 | ) |
| 279 | parser.add_argument( |
| 280 | "-d", "--dry-run", action="store_true", help="just print the list of files" |
| 281 | ) |
| 282 | parser.add_argument( |
| 283 | "-i", |
| 284 | "--in-place", |
| 285 | action="store_true", |
| 286 | help="format file instead of printing differences", |
| 287 | ) |
| 288 | parser.add_argument("files", metavar="file", nargs="+") |
| 289 | parser.add_argument( |
| 290 | "-q", |
| 291 | "--quiet", |
| 292 | action="store_true", |
| 293 | help="disable output, useful for the exit code", |
| 294 | ) |
| 295 | parser.add_argument( |
| 296 | "-j", |
| 297 | metavar="N", |
| 298 | type=int, |
| 299 | default=0, |
| 300 | help="run N clang-format jobs in parallel" " (default number of cpus + 1)", |
| 301 | ) |
| 302 | parser.add_argument( |
| 303 | "--color", |
| 304 | default="auto", |
| 305 | choices=["auto", "always", "never"], |
| 306 | help="show colored diff (default: auto)", |
| 307 | ) |
| 308 | parser.add_argument( |
| 309 | "-e", |
| 310 | "--exclude", |
| 311 | metavar="PATTERN", |
| 312 | action="append", |
| 313 | default=[], |
| 314 | help="exclude paths matching the given glob-like pattern(s)" |
| 315 | " from recursive search", |
no test coverage detected