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