3 releases
0.0.3 | Oct 12, 2024 |
---|---|
0.0.2 | Oct 12, 2024 |
0.0.1 | Sep 21, 2024 |
#27 in #jobs
293 downloads per month
11KB
235 lines
saf
Simple Action Framework written in Rust
TODO
- use crates thiserror and/or anyhow
- use crate tracing, and try to output logs to stderr?
lib.rs
:
Framework for creating plugins and running them via jobs defined in toml files.
The goal of the crate is to make it very easy to implement the following pattern:
- Define a set of Action Structs that implement a common trait.
- Define Jobs (via TOML file) that instantiate an Action Struct with a set of arguments (also specified in the TOML file).
- Run a Job via the command line, allowing to further override the Action arguments.
To start a new project with SAF, run the following
cargo init
The add the following dependencies:
[dependencies]
saf = "0.0.2"
enum_dispatch = "0.3.13"
serde = { version = "1.0.205", features = ["derive"] }
serde_json = "1.0.122"
Then add cargo-run-bin
as a dev dependency to be able to run the SAF binary without installing SAF globally
cargo add cargo-run-bin --dev
Now add this to your Cargo.toml
[package.metadata.bin]
saf = { version = "0.0.3", bins = ["main"] }
Now you can call the SAF cli with
cargo bin saf <COMMAND>
Now run cargo bin saf init
And finally run:
cargo run demo --job-config-repo __jobs
Dependencies
~3–10MB
~107K SLoC