| Crates.io | herosal-do |
| lib.rs | herosal-do |
| version | 0.1.0 |
| created_at | 2025-12-14 02:33:53.031868+00 |
| updated_at | 2025-12-14 02:33:53.031868+00 |
| description | Herosal-do - A Rhai script executor for SAL (System Abstraction Layer) |
| homepage | |
| repository | https://github.com/threefoldtech/sal |
| max_upload_size | |
| id | 1983667 |
| size | 142,771 |
Version: 0.1.0
Herodo is a command-line utility that executes Rhai scripts with full access to the SAL (System Abstraction Layer) library. It provides a powerful scripting environment for automation and system management tasks.
.rhai script files.rhai scripts in a directory (recursively)env_loggergit clone ???
cd sal
./build_herodo.sh
This script will:
~/hero/bin/herodo (non-root) or /usr/local/bin/herodo (root)Note: If using the non-root installation, make sure ~/hero/bin is in your PATH:
export PATH="$HOME/hero/bin:$PATH"
# This will be available once herodo is published to crates.io
cargo install herodo
Note: herodo is not yet published to crates.io due to publishing rate limits. It will be available soon.
herodo path/to/script.rhai
herodo path/to/scripts/
When given a directory, herodo will:
.rhai files// hello.rhai
println("Hello from Herodo!");
let result = 42 * 2;
println("Result: " + result);
// system_info.rhai
println("=== System Information ===");
// Check if a file exists
let config_exists = exist("/etc/hosts");
println("Config file exists: " + config_exists);
// Download a file
download("https://example.com/data.txt", "/tmp/data.txt");
println("File downloaded successfully");
// Execute a system command
let output = run("ls -la /tmp");
println("Directory listing:");
println(output.stdout);
// redis_example.rhai
println("=== Redis Operations ===");
// Set a value
redis_set("app_status", "running");
println("Status set in Redis");
// Get the value
let status = redis_get("app_status");
println("Current status: " + status);
Herodo provides access to all SAL modules through Rhai:
exist(), mkdir(), delete(), file_size()download(), download_install()run(), kill(), process_list()redis_set(), redis_get(), redis_del()Herodo provides clear error messages and appropriate exit codes:
Enable detailed logging by setting the RUST_LOG environment variable:
RUST_LOG=debug herodo script.rhai
Run the test suite:
cd herodo
cargo test
The test suite includes:
Apache-2.0