Skip to main content

ready_set/builtins/
mod.rs

1//! Built-in subcommands of the `ready-set` dispatcher.
2
3pub mod go;
4pub mod help;
5pub mod list;
6pub mod ready;
7pub mod set;
8pub mod version;
9
10use ready_set_sdk::ExitCode;
11
12use crate::env::EnvContract;
13
14/// Type of a built-in handler. Returns the requested process exit code.
15pub type BuiltinFn = fn(&[std::ffi::OsString], &EnvContract) -> ExitCode;
16
17/// Look up a built-in by subcommand name.
18#[must_use]
19pub fn route(name: &str) -> Option<BuiltinFn> {
20    match name {
21        "go" => Some(go::run),
22        "help" => Some(help::run),
23        "version" => Some(version::run),
24        "list" => Some(list::run),
25        "ready" => Some(ready::run),
26        "set" => Some(set::run),
27        _ => None,
28    }
29}