| 1 | # Data Processing Commands |
| 2 | |
| 3 | Data processing commands that demonstrate **dataclass parameter flattening**. |
| 4 | |
| 5 | When using `@Parameter(name="*")` on a dataclass, all its fields become |
| 6 | individual CLI options. This page shows how this appears in documentation. |
| 7 | |
| 8 | ## Data Commands |
| 9 | |
| 10 | ::: cyclopts |
| 11 | module: complex_app:app |
| 12 | heading_level: 3 |
| 13 | recursive: true |
| 14 | commands: [data] |
| 15 | generate_toc: false |
| 16 | |
| 17 | ## Understanding Dataclass Flattening |
| 18 | |
| 19 | The `process` command accepts two dataclass parameters: |
| 20 | |
| 21 | - `ProcessingConfig` - Controls batch size, workers, quality, device, etc. |
| 22 | - `PathConfig` - Controls input/output directories |
| 23 | |
| 24 | Instead of requiring complex nested syntax, these become flat CLI options: |
| 25 | |
| 26 | ```console |
| 27 | $ complex-cli data process file1.txt file2.txt \ |
| 28 | --batch-size 64 \ |
| 29 | --num-workers auto \ |
| 30 | --quality-level high \ |
| 31 | --input-dir ./input \ |
| 32 | --output-dir ./output |
| 33 | ``` |
| 34 | |
| 35 | ## Nested Dataclasses |
| 36 | |
| 37 | The `pipeline` command demonstrates **nested dataclass flattening** where |
| 38 | `PipelineConfig` contains both `PathConfig` and `ProcessingConfig`. |