39 lines
948 B
Rust
39 lines
948 B
Rust
use shitbox::Cmd;
|
|
|
|
mod blkid;
|
|
mod bootstrap;
|
|
mod clear;
|
|
mod mount;
|
|
mod mountpoint;
|
|
mod swaplabel;
|
|
mod swapoff;
|
|
mod swapon;
|
|
mod umount;
|
|
mod utilbox;
|
|
|
|
/// 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 {
|
|
"bootstrap" => Some(Box::new(bootstrap::Bootstrap::default())),
|
|
"clear" => Some(Box::new(clear::Clear::default())),
|
|
"mountpoint" => Some(Box::new(mountpoint::Mountpoint::default())),
|
|
"swaplabel" => Some(Box::new(swaplabel::Swaplabel::default())),
|
|
"swapoff" => Some(Box::new(swapoff::Swapoff::default())),
|
|
"umount" => Some(Box::new(umount::Umount::default())),
|
|
"utilbox" => Some(Box::new(utilbox::Utilbox::default())),
|
|
_ => None,
|
|
}
|
|
}
|
|
|
|
pub static COMMANDS: [&str; 7] = [
|
|
"bootstrap",
|
|
"clear",
|
|
"mountpoint",
|
|
"swaplabel",
|
|
"swapoff",
|
|
"umount",
|
|
"utilbox",
|
|
];
|