Parse command line arguments.
()
| 353 | |
| 354 | |
| 355 | def parse_args() -> argparse.Namespace: |
| 356 | """Parse command line arguments.""" |
| 357 | parser = argparse.ArgumentParser( |
| 358 | description="Phone Agent - AI-powered phone automation", |
| 359 | formatter_class=argparse.RawDescriptionHelpFormatter, |
| 360 | epilog=""" |
| 361 | Examples: |
| 362 | # Run with default settings (Android) |
| 363 | python main.py |
| 364 | |
| 365 | # Specify model endpoint |
| 366 | python main.py --base-url http://localhost:8000/v1 |
| 367 | |
| 368 | # Use API key for authentication |
| 369 | python main.py --apikey sk-xxxxx |
| 370 | |
| 371 | # Run with specific device |
| 372 | python main.py --device-id emulator-5554 |
| 373 | |
| 374 | # Connect to remote device |
| 375 | python main.py --connect 192.168.1.100:5555 |
| 376 | |
| 377 | # List connected devices |
| 378 | python main.py --list-devices |
| 379 | |
| 380 | # Enable TCP/IP on USB device and get connection info |
| 381 | python main.py --enable-tcpip |
| 382 | |
| 383 | # List supported apps |
| 384 | python main.py --list-apps |
| 385 | |
| 386 | # iOS specific examples |
| 387 | # Run with iOS device |
| 388 | python main.py --device-type ios "Open Safari and search for iPhone tips" |
| 389 | |
| 390 | # Use WiFi connection for iOS |
| 391 | python main.py --device-type ios --wda-url http://192.168.1.100:8100 |
| 392 | |
| 393 | # List connected iOS devices |
| 394 | python main.py --device-type ios --list-devices |
| 395 | |
| 396 | # Check WebDriverAgent status |
| 397 | python main.py --device-type ios --wda-status |
| 398 | |
| 399 | # Pair with iOS device |
| 400 | python main.py --device-type ios --pair |
| 401 | """, |
| 402 | ) |
| 403 | |
| 404 | # Model options |
| 405 | parser.add_argument( |
| 406 | "--base-url", |
| 407 | type=str, |
| 408 | default=os.getenv("PHONE_AGENT_BASE_URL", "http://localhost:8000/v1"), |
| 409 | help="Model API base URL", |
| 410 | ) |
| 411 | |
| 412 | parser.add_argument( |