shitbox/utilbox/commands/mod.rs

38 lines
841 B
Rust
Raw Normal View History

use shitbox::Cmd;
mod blkid;
2023-02-13 10:38:02 -05:00
mod bootstrap;
mod clear;
mod mount;
mod mountpoint;
2023-02-07 10:34:09 -05:00
mod swaplabel;
mod swapoff;
mod swapon;
mod umount;
mod utilbox;
2023-02-07 10:34:09 -05:00
/// Parses a string into a command to run
#[must_use]
pub fn get(name: &str) -> Option<Box<dyn Cmd>> {
match name {
"bootstrap" => Some(Box::new(bootstrap::Bootstrap)),
"clear" => Some(Box::new(clear::Clear)),
"mountpoint" => Some(Box::new(mountpoint::Mountpoint)),
"swaplabel" => Some(Box::new(swaplabel::Swaplabel)),
"swapoff" => Some(Box::new(swapoff::Swapoff)),
"umount" => Some(Box::new(umount::Umount)),
"utilbox" => Some(Box::new(utilbox::Utilbox)),
_ => None,
}
}
2023-02-13 10:38:02 -05:00
pub static COMMANDS: [&str; 7] = [
"bootstrap",
2023-02-08 16:20:25 -05:00
"clear",
"mountpoint",
"swaplabel",
"swapoff",
"umount",
"utilbox",
];