2023-02-06 18:57:28 -05:00
|
|
|
use shitbox::Cmd;
|
|
|
|
|
|
|
|
mod blkid;
|
2023-02-13 10:30:46 -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]
|
|
|
|
#[allow(clippy::box_default)]
|
|
|
|
pub fn get(name: &str) -> Option<Box<dyn Cmd>> {
|
|
|
|
match name {
|
2023-02-13 10:30:46 -05:00
|
|
|
"bootstrap" => Some(Box::new(bootstrap::Bootstrap::default())),
|
2023-02-06 18:57:28 -05:00
|
|
|
"clear" => Some(Box::new(clear::Clear::default())),
|
|
|
|
"mountpoint" => Some(Box::new(mountpoint::Mountpoint::default())),
|
2023-02-07 10:34:09 -05:00
|
|
|
"swaplabel" => Some(Box::new(swaplabel::Swaplabel::default())),
|
2023-02-08 16:20:25 -05:00
|
|
|
"swapoff" => Some(Box::new(swapoff::Swapoff::default())),
|
2023-02-06 18:57:28 -05:00
|
|
|
"umount" => Some(Box::new(umount::Umount::default())),
|
|
|
|
"utilbox" => Some(Box::new(utilbox::Utilbox::default())),
|
|
|
|
_ => None,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-02-13 10:30:46 -05:00
|
|
|
pub static COMMANDS: [&str; 7] = [
|
|
|
|
"bootstrap",
|
2023-02-08 16:20:25 -05:00
|
|
|
"clear",
|
|
|
|
"mountpoint",
|
|
|
|
"swaplabel",
|
|
|
|
"swapoff",
|
|
|
|
"umount",
|
|
|
|
"utilbox",
|
|
|
|
];
|