libtbr/README.md
2025-09-10 10:25:21 +07:00

44 lines
800 B
Markdown

# libtbr
`libtbr` is swiss-knife toolbox for Taobin project.
```
cargo add --git https://gitlab.forthrd.io/Pakin/libtbr.git
```
```
cargo update
```
## Examples
### Initialize Config
```rust
use libtbr::recipe_functions::common;
// this read file `.tbcfg` in the current directory
let cfg = common::get_config();
let recipe_dir = cfg.get("RECIPE_DIR").unwrap();
```
---
### Get recipe from specific country (latest)
```rust
...
let latest_versions = grep_latest_versions(recipe_dir).unwrap();
// try get malaysia recipe, may fail if country does not exist
let mys_version = latest_versions.get("mys");
// try to create malaysia recipe model
let mys_recipe_model = common::create_recipe_model_from_file(common::create_recipe_path(
"mys",
*mys_version.unwrap(),
));
...
```
...WIP