Rhask – Rhai-based Task Runner
Rhask is a lightweight task runner that lets you describe tasks in Rhai and execute them from a Rust CLI. Tasks and groups can be nested freely, and every entry can be invoked by its fully qualified name such as group.task. When a leaf name is unique, you can also call it without the prefix.

Quick Start (Install / Setup)
# Install from crates.io
# Example: list tasks at the project root
# Example: run a task
- Place
rhaskfile.rhaiat your repository root (copyrhaskfile_demo.rhaiorrhaskfile_sample.rhaito get started). - To try the demo without touching your root, run
rhask -f ./rhaskfile_demo.rhai list. - You can skip the
runsubcommand and execute tasks asrhask <task>; it behaves exactly likerhask run <task>.
Features
- Task definitions live in
rhaskfile.rhaiat the repository root. - At startup Rhask searches the current directory and walks up parent directories until it finds
rhaskfile.rhai(override with-f/--file). rhask listrenders tasks and groups as a tree.rhask list --flat(or-F) prints each task asfull.path<TAB>Description, which is convenient for piping intofzf,peco, etc.rhask run(or the shorthandrhask <task>) accepts both short names and fully qualified names. When a name is ambiguous, Rhask prints the candidates and asks you to re-run with a full path.- Use
description(),actions(), andargs()insidetask()orgroup()blocks to declare metadata, logic, and parameters. - Arguments support positional values,
key=value,--key=value, and--key valuestyles. Defaults and required flags are declared viaargs(#{ ... }). - Logging is powered by
env_logger. Regular runs stay quiet, whileRUST_LOG=debug rhask run …surfaces the internal trace.
Usage
CLI Commands
| Command | Description |
|---|---|
rhask list [group] |
Display tasks/groups as a tree. Passing group limits the output to that subtree; use fully qualified names like deploy.staging for nested groups. |
rhask list --flat / rhask list -F |
Emit each task as full.path followed by an aligned description. Works with group filters and is ideal for piping into tools such as fzf. |
rhask run <task> [args…] |
Execute a task. Supports both short names and fully qualified names; ambiguous leaves print candidate paths and abort. You can omit run and type rhask <task> as shorthand. |
rhask -f <file> … |
Explicitly load a Rhai script (the flag can appear anywhere in the command). |
Passing Arguments
Declare parameters in Rhai, e.g. args(#{ target: (), profile: "debug" }). Positional arguments follow the lexicographic order of the keys (this example maps to profile → target). () means “no default = required”. Favor named forms when order matters, and supply values from the CLI using:
- Positional (key order):
rhask run build release x86_64-unknown-linux-gnu key=value:rhask run build profile=release--key=value:rhask run build --target=x86_64-apple-darwin--key value:rhask run build --target wasm32-unknown-unknown- Any mixture of the above
Unknown keys raise an error. Parameters marked as required (()) must be provided or the run fails with a descriptive message.
Task Definition Example
task("build", || {
description("Build the project");
args(#{
target: (),
profile: "debug"
});
actions(|profile, target| {
print("build => profile:" + profile + ", target:" + target);
});
});
group("release_flow", || {
description("Release tasks");
task("package", || {
actions(|| { exec("cargo package"); });
});
});
Rhai Helpers
| Helper | Description |
|---|---|
task(name, || { ... }) |
Declare a task and call description / actions / args inside it. |
group(name, || { ... }) |
Declare a group that can contain tasks or nested sub-groups. |
description(text) |
Attach a description to the current task or group. |
actions(|| { ... }) |
Register the execution closure. Only inside this closure may you call trigger / exec. |
args(#{ key1: default1, key2: (), ... }) |
Declare CLI parameters. () signals “no default = required”. |
trigger(name, positional?, named?) |
Reuse another task. Provide arrays/maps for positional/named arguments. |
exec(command) |
Run an external command via the shell. Returns () on success. |
triggerandexecare restricted toactions(); misusing them aborts script loading with an error.
Logs & Output
- User-facing messages are separated: informational lines go to
stdout, warnings/errors tostderr. - Logging relies on
env_logger. SetRUST_LOG=debug rhask run …(ortrace, etc.) when you need troubleshooting details. - Color output is automatically enabled when stdout is a TTY and disabled for non-TTY contexts such as CI pipelines.
License
Dual-licensed under MIT OR Apache-2.0.
See LICENSE-MIT and LICENSE-APACHE for details.