2023-02-06 18:57:28 -05:00
|
|
|
use shitbox::Cmd;
|
|
|
|
|
|
|
|
mod blkid;
|
2023-02-13 10:38:02 -05:00
|
|
|
mod bootstrap;
|
2023-02-06 18:57:28 -05:00
|
|
|
mod clear;
|
|
|
|
mod mount;
|
|
|
|
mod mountpoint;
|
2023-02-07 10:34:09 -05:00
|
|
|
mod swaplabel;
|
|
|
|
mod swapoff;
|
|
|
|
mod swapon;
|
2023-02-06 18:57:28 -05:00
|
|
|
mod umount;
|
|
|
|
mod utilbox;
|
2023-02-07 10:34:09 -05:00
|
|
|
|
2023-02-06 18:57:28 -05:00
|
|
|
/// Parses a string into a command to run
|
|
|
|
#[must_use]
|
|
|
|
pub fn get(name: &str) -> Option<Box<dyn Cmd>> {
|
|
|
|
match name {
|
2023-04-17 23:27:57 -04:00
|
|
|
"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)),
|
2023-02-06 18:57:28 -05:00
|
|
|
_ => 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",
|
|
|
|
];
|