Parse command-line arguments and dispatch to the appropriate task module.
()
| 246 | |
| 247 | |
| 248 | def parse_args(): |
| 249 | """Parse command-line arguments and dispatch to the appropriate task module.""" |
| 250 | parser = argparse.ArgumentParser( |
| 251 | description="Fory CI Runner", |
| 252 | formatter_class=argparse.ArgumentDefaultsHelpFormatter, |
| 253 | ) |
| 254 | parser.set_defaults(func=lambda: parser.print_help()) |
| 255 | subparsers = parser.add_subparsers(dest="command") |
| 256 | |
| 257 | # C++ subparser |
| 258 | cpp_parser = subparsers.add_parser( |
| 259 | "cpp", |
| 260 | description="Run C++ CI", |
| 261 | help="Run C++ CI", |
| 262 | formatter_class=argparse.ArgumentDefaultsHelpFormatter, |
| 263 | ) |
| 264 | cpp_parser.add_argument( |
| 265 | "--install-deps-only", |
| 266 | action="store_true", |
| 267 | help="Only install dependencies without running tests", |
| 268 | ) |
| 269 | cpp_parser.add_argument( |
| 270 | "--skip-doc-tests", |
| 271 | action="store_true", |
| 272 | help="Skip documentation example tests", |
| 273 | ) |
| 274 | cpp_parser.add_argument( |
| 275 | "--doc-tests-only", |
| 276 | action="store_true", |
| 277 | help="Only run documentation example tests", |
| 278 | ) |
| 279 | cpp_parser.set_defaults( |
| 280 | func=lambda install_deps_only, skip_doc_tests, doc_tests_only: cpp.run( |
| 281 | install_deps_only, skip_doc_tests, doc_tests_only |
| 282 | ) |
| 283 | ) |
| 284 | |
| 285 | # Rust subparser |
| 286 | rust_parser = subparsers.add_parser( |
| 287 | "rust", |
| 288 | description="Run Rust CI", |
| 289 | help="Run Rust CI", |
| 290 | formatter_class=argparse.ArgumentDefaultsHelpFormatter, |
| 291 | ) |
| 292 | rust_parser.set_defaults(func=rust.run) |
| 293 | |
| 294 | # JavaScript subparser |
| 295 | js_parser = subparsers.add_parser( |
| 296 | "javascript", |
| 297 | description="Run JavaScript CI", |
| 298 | help="Run JavaScript CI", |
| 299 | formatter_class=argparse.ArgumentDefaultsHelpFormatter, |
| 300 | ) |
| 301 | js_parser.set_defaults(func=javascript.run) |
| 302 | |
| 303 | # Java subparser |
| 304 | java_parser = subparsers.add_parser( |
| 305 | "java", |
no test coverage detected