Expand description
YATR - A modern task runner for Rust projects
This crate provides both a CLI tool and a library for task automation.
§Features
- Simple TOML configuration - Define tasks in a familiar format
- Rhai scripting - Embedded scripting for complex task logic
- Content-addressable caching - Skip unchanged tasks
- File watching - Re-run tasks on file changes
- Parallel execution - Run independent tasks concurrently
- Dependency resolution - Automatic task ordering
§Example
# YATR.toml
[tasks.test]
desc = "Run all tests"
run = ["cargo test --all-targets"]
[tasks.build]
desc = "Build release"
depends = ["test"]
run = ["cargo build --release"]§Library Usage
ⓘ
use yatr::{Config, TaskGraph, Executor, ExecutorConfig};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let (config, _) = Config::load(None)?;
let graph = TaskGraph::from_config(&config)?;
let executor = Executor::new(config, ExecutorConfig::default(), None);
executor.execute(&graph, "build").await?;
Ok(())
}Re-exports§
pub use cache::Cache;pub use config::Config;pub use error::Result;pub use error::YatrError;pub use executor::Executor;pub use executor::ExecutorConfig;pub use executor::TaskResult;pub use graph::ExecutionPlan;pub use graph::TaskGraph;pub use graph::TaskNode;pub use script::ScriptEngine;