| Crates.io | baobao-codegen-rust |
| lib.rs | baobao-codegen-rust |
| version | 0.5.0 |
| created_at | 2025-12-07 15:21:15.310026+00 |
| updated_at | 2025-12-24 15:35:14.183998+00 |
| description | Rust code generator for Bao CLI generator |
| homepage | https://github.com/roushou/bao |
| repository | https://github.com/roushou/bao |
| max_upload_size | |
| id | 1971771 |
| size | 194,493 |
Rust code generator for Bao CLI generator.
This crate generates Rust CLI applications using clap for argument parsing.
This crate is used internally by the baobao CLI tool. You typically don't need to use it directly.
use baobao_codegen_rust::Generator;
use baobao_codegen::LanguageCodegen;
use baobao_manifest::Manifest;
use std::path::Path;
let manifest = Manifest::from_file("bao.toml")?;
let generator = Generator::new(&manifest);
// Preview files without writing
let files = generator.preview();
// Generate files to disk
let result = generator.generate(Path::new("output"))?;
The generator produces a Rust CLI project:
output/
├── src/
│ ├── cli.rs # CLI definition with clap derive macros
│ ├── context.rs # Shared context (database pools, HTTP clients)
│ ├── main.rs # Entry point and command dispatch
│ ├── commands/ # Command modules
│ │ └── *.rs
│ └── handlers/ # Handler stubs for implementation
│ └── *.rs
├── Cargo.toml
├── bao.toml
└── .gitignore
This project is licensed under the MIT license.