Remove Default constraint on Cmd trait and begin removing

derive(Default) from applets
This commit is contained in:
Nathan Fisher 2023-04-17 23:27:57 -04:00
parent edbabc11c1
commit d248f7d17b
58 changed files with 117 additions and 120 deletions

View File

@ -9,7 +9,7 @@ use std::{
}; };
use termcolor::{Color, ColorChoice, ColorSpec, StandardStream, WriteColor}; use termcolor::{Color, ColorChoice, ColorSpec, StandardStream, WriteColor};
#[derive(Debug, Default)] #[derive(Debug)]
pub struct Base32; pub struct Base32;
impl Cmd for Base32 { impl Cmd for Base32 {

View File

@ -8,7 +8,7 @@ use std::{
}; };
use termcolor::{Color, ColorChoice, ColorSpec, StandardStream, WriteColor}; use termcolor::{Color, ColorChoice, ColorSpec, StandardStream, WriteColor};
#[derive(Debug, Default)] #[derive(Debug)]
pub struct Base64; pub struct Base64;
impl Cmd for Base64 { impl Cmd for Base64 {

View File

@ -1,7 +1,7 @@
use super::Cmd; use super::Cmd;
use clap::{Arg, ArgMatches, Command}; use clap::{Arg, ArgMatches, Command};
#[derive(Debug, Default)] #[derive(Debug)]
pub struct Basename; pub struct Basename;
impl Cmd for Basename { impl Cmd for Basename {

View File

@ -10,7 +10,7 @@ use std::{
path::{Path, PathBuf}, path::{Path, PathBuf},
}; };
#[derive(Debug, Default)] #[derive(Debug)]
pub struct Bootstrap; pub struct Bootstrap;
impl Bootstrap { impl Bootstrap {

View File

@ -11,7 +11,7 @@ use std::{
}; };
use walkdir::{DirEntry, WalkDir}; use walkdir::{DirEntry, WalkDir};
#[derive(Debug, Default)] #[derive(Debug)]
pub struct Chmod; pub struct Chmod;
impl Cmd for Chmod { impl Cmd for Chmod {

View File

@ -13,7 +13,7 @@ use walkdir::{DirEntry, WalkDir};
mod chgrp; mod chgrp;
pub use chgrp::Chgrp; pub use chgrp::Chgrp;
#[derive(Debug, Default)] #[derive(Debug)]
pub struct Chown; pub struct Chown;
impl Cmd for Chown { impl Cmd for Chown {

View File

@ -6,7 +6,7 @@ use std::{
process, process,
}; };
#[derive(Debug, Default)] #[derive(Debug)]
pub struct Chroot; pub struct Chroot;
impl Cmd for Chroot { impl Cmd for Chroot {

View File

@ -3,7 +3,7 @@ use clap::Command;
use shitbox::Cmd; use shitbox::Cmd;
use std::{error::Error, process}; use std::{error::Error, process};
#[derive(Debug, Default)] #[derive(Debug)]
pub struct Corebox; pub struct Corebox;
impl Cmd for Corebox { impl Cmd for Corebox {

View File

@ -8,7 +8,7 @@ use std::{
usize, vec, usize, vec,
}; };
#[derive(Debug, Default)] #[derive(Debug)]
pub struct Cut; pub struct Cut;
impl Cmd for Cut { impl Cmd for Cut {

View File

@ -4,7 +4,7 @@ use shitbox::Cmd;
use size_display::Size; use size_display::Size;
use std::{error::Error, fmt, io, path::PathBuf}; use std::{error::Error, fmt, io, path::PathBuf};
#[derive(Debug, Default)] #[derive(Debug)]
pub struct Df; pub struct Df;
impl Cmd for Df { impl Cmd for Df {

View File

@ -2,7 +2,7 @@ use super::Cmd;
use clap::{Arg, ArgAction, Command}; use clap::{Arg, ArgAction, Command};
use std::path::Path; use std::path::Path;
#[derive(Debug, Default)] #[derive(Debug)]
pub struct Dirname; pub struct Dirname;
impl Cmd for Dirname { impl Cmd for Dirname {

View File

@ -2,7 +2,7 @@ use super::Cmd;
use clap::{Arg, Command}; use clap::{Arg, Command};
use std::{env, error::Error}; use std::{env, error::Error};
#[derive(Debug, Default)] #[derive(Debug)]
pub struct Echo; pub struct Echo;
impl Cmd for Echo { impl Cmd for Echo {

View File

@ -1,7 +1,7 @@
use super::Cmd; use super::Cmd;
use clap::{Arg, ArgAction, Command, ValueHint}; use clap::{Arg, ArgAction, Command, ValueHint};
#[derive(Debug, Default)] #[derive(Debug)]
pub struct Expand; pub struct Expand;
impl Cmd for Expand { impl Cmd for Expand {

View File

@ -5,7 +5,7 @@ use std::{
io::{self, BufRead}, io::{self, BufRead},
}; };
#[derive(Debug, Default)] #[derive(Debug)]
pub struct Factor; pub struct Factor;
impl Cmd for Factor { impl Cmd for Factor {

View File

@ -2,7 +2,7 @@ use super::Cmd;
use clap::Command; use clap::Command;
use std::{error::Error, process}; use std::{error::Error, process};
#[derive(Debug, Default)] #[derive(Debug)]
pub struct False; pub struct False;
impl Cmd for False { impl Cmd for False {

View File

@ -6,7 +6,7 @@ use std::{
}; };
use textwrap::{fill, wrap_algorithms::WrapAlgorithm}; use textwrap::{fill, wrap_algorithms::WrapAlgorithm};
#[derive(Debug, Default)] #[derive(Debug)]
pub struct Fold; pub struct Fold;
impl Cmd for Fold { impl Cmd for Fold {

View File

@ -1,7 +1,7 @@
use super::Cmd; use super::Cmd;
use clap::{Arg, Command}; use clap::{Arg, Command};
#[derive(Debug, Default)] #[derive(Debug)]
pub struct Groups; pub struct Groups;
impl Cmd for Groups { impl Cmd for Groups {

View File

@ -9,7 +9,7 @@ use std::{
}; };
use termcolor::{Color, ColorChoice, ColorSpec, StandardStream, WriteColor}; use termcolor::{Color, ColorChoice, ColorSpec, StandardStream, WriteColor};
#[derive(Debug, Default)] #[derive(Debug)]
pub struct Head; pub struct Head;
impl Cmd for Head { impl Cmd for Head {

View File

@ -1,7 +1,7 @@
use super::Cmd; use super::Cmd;
use clap::Command; use clap::Command;
#[derive(Debug, Default)] #[derive(Debug)]
pub struct Hostid; pub struct Hostid;
impl Cmd for Hostid { impl Cmd for Hostid {

View File

@ -2,7 +2,7 @@ use super::Cmd;
use clap::{Arg, ArgAction, ArgMatches, Command}; use clap::{Arg, ArgAction, ArgMatches, Command};
use std::{error::Error, io}; use std::{error::Error, io};
#[derive(Debug, Default)] #[derive(Debug)]
pub struct Hostname; pub struct Hostname;
impl Cmd for Hostname { impl Cmd for Hostname {

View File

@ -3,7 +3,7 @@ use clap::{Arg, Command};
use shitbox::args; use shitbox::args;
use std::{fs, io}; use std::{fs, io};
#[derive(Debug, Default)] #[derive(Debug)]
pub struct Link; pub struct Link;
impl Cmd for Link { impl Cmd for Link {

View File

@ -2,7 +2,7 @@ use super::Cmd;
use clap::{Arg, ArgAction, Command}; use clap::{Arg, ArgAction, Command};
use std::{error::Error, fs, io, os, path::PathBuf}; use std::{error::Error, fs, io, os, path::PathBuf};
#[derive(Debug, Default)] #[derive(Debug)]
pub struct Ln; pub struct Ln;
impl Cmd for Ln { impl Cmd for Ln {

View File

@ -3,7 +3,7 @@ use std::ffi::CStr;
use super::Cmd; use super::Cmd;
use clap::Command; use clap::Command;
#[derive(Debug, Default)] #[derive(Debug)]
pub struct Logname; pub struct Logname;
impl Cmd for Logname { impl Cmd for Logname {

View File

@ -4,7 +4,7 @@ use mode::Parser;
use shitbox::args; use shitbox::args;
use std::error::Error; use std::error::Error;
#[derive(Debug, Default)] #[derive(Debug)]
pub struct MkFifo; pub struct MkFifo;
impl Cmd for MkFifo { impl Cmd for MkFifo {

View File

@ -4,7 +4,7 @@ use mode::{get_umask, Parser};
use shitbox::args; use shitbox::args;
use std::{convert::Infallible, error::Error, io, str::FromStr}; use std::{convert::Infallible, error::Error, io, str::FromStr};
#[derive(Debug, Default)] #[derive(Debug)]
pub struct MkNod; pub struct MkNod;
impl Cmd for MkNod { impl Cmd for MkNod {

View File

@ -2,7 +2,7 @@ use super::Cmd;
use clap::{Arg, ArgAction, Command, ValueHint}; use clap::{Arg, ArgAction, Command, ValueHint};
use std::{ffi::CString, fs, io, path::PathBuf}; use std::{ffi::CString, fs, io, path::PathBuf};
#[derive(Debug, Default)] #[derive(Debug)]
pub struct MkTemp; pub struct MkTemp;
impl Cmd for MkTemp { impl Cmd for MkTemp {

View File

@ -57,55 +57,54 @@ mod yes;
/// Parses a string into a command to run /// Parses a string into a command to run
#[must_use] #[must_use]
#[allow(clippy::box_default)]
pub fn get(name: &str) -> Option<Box<dyn Cmd>> { pub fn get(name: &str) -> Option<Box<dyn Cmd>> {
match name { match name {
"base64" => Some(Box::new(base64::Base64::default())), "base64" => Some(Box::new(base64::Base64)),
"base32" => Some(Box::new(base32::Base32::default())), "base32" => Some(Box::new(base32::Base32)),
"basename" => Some(Box::new(basename::Basename::default())), "basename" => Some(Box::new(basename::Basename)),
"bootstrap" => Some(Box::new(bootstrap::Bootstrap::default())), "bootstrap" => Some(Box::new(bootstrap::Bootstrap)),
"chmod" => Some(Box::new(chmod::Chmod::default())), "chmod" => Some(Box::new(chmod::Chmod)),
"chgrp" => Some(Box::new(chown::Chgrp::default())), "chgrp" => Some(Box::new(chown::Chgrp)),
"chown" => Some(Box::new(chown::Chown::default())), "chown" => Some(Box::new(chown::Chown)),
"chroot" => Some(Box::new(chroot::Chroot::default())), "chroot" => Some(Box::new(chroot::Chroot)),
"corebox" => Some(Box::new(corebox::Corebox::default())), "corebox" => Some(Box::new(corebox::Corebox)),
"cut" => Some(Box::new(cut::Cut::default())), "cut" => Some(Box::new(cut::Cut)),
"df" => Some(Box::new(df::Df::default())), "df" => Some(Box::new(df::Df)),
"dirname" => Some(Box::new(dirname::Dirname::default())), "dirname" => Some(Box::new(dirname::Dirname)),
"echo" => Some(Box::new(echo::Echo::default())), "echo" => Some(Box::new(echo::Echo)),
"factor" => Some(Box::new(factor::Factor::default())), "factor" => Some(Box::new(factor::Factor)),
"false" => Some(Box::new(r#false::False::default())), "false" => Some(Box::new(r#false::False)),
"fold" => Some(Box::new(fold::Fold::default())), "fold" => Some(Box::new(fold::Fold)),
"groups" => Some(Box::new(groups::Groups::default())), "groups" => Some(Box::new(groups::Groups)),
"head" => Some(Box::new(head::Head::default())), "head" => Some(Box::new(head::Head)),
"hostid" => Some(Box::new(hostid::Hostid::default())), "hostid" => Some(Box::new(hostid::Hostid)),
"hostname" => Some(Box::new(hostname::Hostname::default())), "hostname" => Some(Box::new(hostname::Hostname)),
"link" => Some(Box::new(link::Link::default())), "link" => Some(Box::new(link::Link)),
"ln" => Some(Box::new(ln::Ln::default())), "ln" => Some(Box::new(ln::Ln)),
"logname" => Some(Box::new(logname::Logname::default())), "logname" => Some(Box::new(logname::Logname)),
"mkfifo" => Some(Box::new(mkfifo::MkFifo::default())), "mkfifo" => Some(Box::new(mkfifo::MkFifo)),
"mknod" => Some(Box::new(mknod::MkNod::default())), "mknod" => Some(Box::new(mknod::MkNod)),
"mktemp" => Some(Box::new(mktemp::MkTemp::default())), "mktemp" => Some(Box::new(mktemp::MkTemp)),
"nologin" => Some(Box::new(nologin::Nologin::default())), "nologin" => Some(Box::new(nologin::Nologin)),
"nproc" => Some(Box::new(nproc::Nproc::default())), "nproc" => Some(Box::new(nproc::Nproc)),
"printenv" => Some(Box::new(printenv::Printenv::default())), "printenv" => Some(Box::new(printenv::Printenv)),
"pwd" => Some(Box::new(pwd::Pwd::default())), "pwd" => Some(Box::new(pwd::Pwd)),
"readlink" => Some(Box::new(readlink::Readlink::default())), "readlink" => Some(Box::new(readlink::Readlink)),
"realpath" => Some(Box::new(realpath::Realpath::default())), "realpath" => Some(Box::new(realpath::Realpath)),
"rev" => Some(Box::new(rev::Rev::default())), "rev" => Some(Box::new(rev::Rev)),
"rm" => Some(Box::new(rm::Rm::default())), "rm" => Some(Box::new(rm::Rm)),
"rmdir" => Some(Box::new(rmdir::Rmdir::default())), "rmdir" => Some(Box::new(rmdir::Rmdir)),
"sleep" => Some(Box::new(sleep::Sleep::default())), "sleep" => Some(Box::new(sleep::Sleep)),
"sync" => Some(Box::new(sync::Sync::default())), "sync" => Some(Box::new(sync::Sync)),
"touch" => Some(Box::new(touch::Touch::default())), "touch" => Some(Box::new(touch::Touch)),
"true" => Some(Box::new(r#true::True::default())), "true" => Some(Box::new(r#true::True)),
"truncate" => Some(Box::new(truncate::Truncate)), "truncate" => Some(Box::new(truncate::Truncate)),
"unlink" => Some(Box::new(unlink::Unlink::default())), "unlink" => Some(Box::new(unlink::Unlink)),
"wc" => Some(Box::new(wc::Wc::default())), "wc" => Some(Box::new(wc::Wc)),
"which" => Some(Box::new(which::Which::default())), "which" => Some(Box::new(which::Which)),
"who" => Some(Box::new(who::Who::default())), "who" => Some(Box::new(who::Who)),
"whoami" => Some(Box::new(whoami::Whoami::default())), "whoami" => Some(Box::new(whoami::Whoami)),
"yes" => Some(Box::new(yes::Yes::default())), "yes" => Some(Box::new(yes::Yes)),
_ => None, _ => None,
} }
} }

View File

@ -2,7 +2,7 @@ use super::Cmd;
use clap::Command; use clap::Command;
use std::process; use std::process;
#[derive(Debug, Default)] #[derive(Debug)]
pub struct Nologin; pub struct Nologin;
impl Cmd for Nologin { impl Cmd for Nologin {

View File

@ -1,7 +1,7 @@
use super::Cmd; use super::Cmd;
use clap::{Arg, ArgAction, Command}; use clap::{Arg, ArgAction, Command};
#[derive(Debug, Default)] #[derive(Debug)]
pub struct Nproc; pub struct Nproc;
impl Cmd for Nproc { impl Cmd for Nproc {

View File

@ -3,7 +3,7 @@ use std::env;
use super::Cmd; use super::Cmd;
use clap::{Arg, ArgAction, Command}; use clap::{Arg, ArgAction, Command};
#[derive(Debug, Default)] #[derive(Debug)]
pub struct Printenv; pub struct Printenv;
impl Cmd for Printenv { impl Cmd for Printenv {

View File

@ -2,7 +2,7 @@ use super::Cmd;
use clap::{Arg, ArgAction, Command}; use clap::{Arg, ArgAction, Command};
use std::{env, path::PathBuf}; use std::{env, path::PathBuf};
#[derive(Debug, Default)] #[derive(Debug)]
pub struct Pwd; pub struct Pwd;
impl Cmd for Pwd { impl Cmd for Pwd {

View File

@ -2,7 +2,7 @@ use clap::{Arg, ArgAction, ArgMatches, Command, ValueHint};
use shitbox::Cmd; use shitbox::Cmd;
use std::{fs, path::PathBuf}; use std::{fs, path::PathBuf};
#[derive(Debug, Default)] #[derive(Debug)]
pub struct Readlink; pub struct Readlink;
impl Cmd for Readlink { impl Cmd for Readlink {

View File

@ -2,7 +2,7 @@ use super::Cmd;
use clap::{Arg, ArgAction, Command, ValueHint}; use clap::{Arg, ArgAction, Command, ValueHint};
use std::{env, fs, process}; use std::{env, fs, process};
#[derive(Debug, Default)] #[derive(Debug)]
pub struct Realpath; pub struct Realpath;
impl Cmd for Realpath { impl Cmd for Realpath {

View File

@ -7,7 +7,7 @@ use std::{
}; };
use termcolor::{Color, ColorChoice, ColorSpec, StandardStream, WriteColor}; use termcolor::{Color, ColorChoice, ColorSpec, StandardStream, WriteColor};
#[derive(Debug, Default)] #[derive(Debug)]
pub struct Rev; pub struct Rev;
impl Cmd for Rev { impl Cmd for Rev {

View File

@ -10,7 +10,7 @@ use std::{
str::FromStr, str::FromStr,
}; };
#[derive(Debug, Default)] #[derive(Debug)]
pub struct Rm; pub struct Rm;
impl Cmd for Rm { impl Cmd for Rm {

View File

@ -3,7 +3,7 @@ use clap::{Arg, ArgAction, Command, ValueHint};
use shitbox::args; use shitbox::args;
use std::{error::Error, fs, path::Path}; use std::{error::Error, fs, path::Path};
#[derive(Debug, Default)] #[derive(Debug)]
pub struct Rmdir; pub struct Rmdir;
impl Cmd for Rmdir { impl Cmd for Rmdir {

View File

@ -2,7 +2,7 @@ use super::Cmd;
use clap::{value_parser, Arg, ArgAction, ArgMatches, Command}; use clap::{value_parser, Arg, ArgAction, ArgMatches, Command};
use std::{env, error::Error, thread, time::Duration}; use std::{env, error::Error, thread, time::Duration};
#[derive(Debug, Default)] #[derive(Debug)]
pub struct Sleep; pub struct Sleep;
impl Cmd for Sleep { impl Cmd for Sleep {

View File

@ -2,7 +2,7 @@ use super::Cmd;
use clap::{Arg, ArgAction, Command}; use clap::{Arg, ArgAction, Command};
use std::{error::Error, fs::OpenOptions}; use std::{error::Error, fs::OpenOptions};
#[derive(Debug, Default)] #[derive(Debug)]
pub struct Sync; pub struct Sync;
impl Cmd for Sync { impl Cmd for Sync {

View File

@ -4,7 +4,7 @@ use filetime::*;
use shitbox::Cmd; use shitbox::Cmd;
use std::{error::Error, fs::File, io, path::PathBuf}; use std::{error::Error, fs::File, io, path::PathBuf};
#[derive(Debug, Default)] #[derive(Debug)]
pub struct Touch; pub struct Touch;
impl Cmd for Touch { impl Cmd for Touch {

View File

@ -2,7 +2,7 @@ use super::Cmd;
use clap::Command; use clap::Command;
use std::{error::Error, process}; use std::{error::Error, process};
#[derive(Debug, Default)] #[derive(Debug)]
pub struct True; pub struct True;
impl Cmd for True { impl Cmd for True {

View File

@ -4,7 +4,7 @@ use {
std::{error::Error, fmt, fs::{self, File}, num::ParseIntError, path::PathBuf}, std::{error::Error, fmt, fs::{self, File}, num::ParseIntError, path::PathBuf},
}; };
#[derive(Debug, Default)] #[derive(Debug)]
pub struct Truncate; pub struct Truncate;
impl Cmd for Truncate { impl Cmd for Truncate {

View File

@ -2,7 +2,7 @@ use super::Cmd;
use clap::{Arg, Command}; use clap::{Arg, Command};
use shitbox::args; use shitbox::args;
#[derive(Debug, Default)] #[derive(Debug)]
pub struct Unlink; pub struct Unlink;
impl Cmd for Unlink { impl Cmd for Unlink {

View File

@ -11,7 +11,7 @@ use std::{
str::FromStr, str::FromStr,
}; };
#[derive(Debug, Default)] #[derive(Debug)]
pub struct Wc; pub struct Wc;
impl Cmd for Wc { impl Cmd for Wc {

View File

@ -4,7 +4,7 @@ use clap::{Arg, Command};
use mode::Bit; use mode::Bit;
use std::{env, fs::File, os::unix::prelude::MetadataExt, path::PathBuf, process}; use std::{env, fs::File, os::unix::prelude::MetadataExt, path::PathBuf, process};
#[derive(Debug, Default)] #[derive(Debug)]
pub struct Which; pub struct Which;
impl Cmd for Which { impl Cmd for Which {

View File

@ -2,7 +2,7 @@ use clap::{Arg, ArgAction, Command};
use shitbox::Cmd; use shitbox::Cmd;
use utmp_rs::UtmpEntry; use utmp_rs::UtmpEntry;
#[derive(Debug, Default)] #[derive(Debug)]
pub struct Who; pub struct Who;
impl Cmd for Who { impl Cmd for Who {

View File

@ -5,7 +5,7 @@ use {
std::ffi::CStr, std::ffi::CStr,
}; };
#[derive(Debug, Default)] #[derive(Debug)]
pub struct Whoami; pub struct Whoami;
impl Cmd for Whoami { impl Cmd for Whoami {

View File

@ -1,7 +1,7 @@
use super::Cmd; use super::Cmd;
use clap::{Arg, Command}; use clap::{Arg, Command};
#[derive(Debug, Default)] #[derive(Debug)]
pub struct Yes; pub struct Yes;
impl Cmd for Yes { impl Cmd for Yes {

View File

@ -12,18 +12,17 @@ mod sha512sum;
/// Parses a string into a command to run /// Parses a string into a command to run
#[must_use] #[must_use]
#[allow(clippy::box_default)]
pub fn get(name: &str) -> Option<Box<dyn Cmd>> { pub fn get(name: &str) -> Option<Box<dyn Cmd>> {
match name { match name {
"b2sum" => Some(Box::new(b2sum::B2sum::default())), "b2sum" => Some(Box::new(b2sum::B2sum)),
"bootstrap" => Some(Box::new(bootstrap::Bootstrap::default())), "bootstrap" => Some(Box::new(bootstrap::Bootstrap)),
"hashbox" => Some(Box::new(hashbox::Hashbox::default())), "hashbox" => Some(Box::new(hashbox::Hashbox)),
"md5sum" => Some(Box::new(md5sum::Md5sum::default())), "md5sum" => Some(Box::new(md5sum::Md5sum)),
"sha1sum" => Some(Box::new(sha1sum::Sha1sum::default())), "sha1sum" => Some(Box::new(sha1sum::Sha1sum)),
"sha224sum" => Some(Box::new(sha224sum::Sha224sum::default())), "sha224sum" => Some(Box::new(sha224sum::Sha224sum)),
"sha256sum" => Some(Box::new(sha256sum::Sha256sum::default())), "sha256sum" => Some(Box::new(sha256sum::Sha256sum)),
"sha384sum" => Some(Box::new(sha384sum::Sha384sum::default())), "sha384sum" => Some(Box::new(sha384sum::Sha384sum)),
"sha512sum" => Some(Box::new(sha512sum::Sha512sum::default())), "sha512sum" => Some(Box::new(sha512sum::Sha512sum)),
_ => None, _ => None,
} }
} }

View File

@ -1,9 +1,9 @@
use clap::ArgMatches; use clap::ArgMatches;
use std::{error::Error, fmt}; use std::error::Error;
/// Defines a command or applet, it's cli interface, and it's installation directory /// Defines a command or applet, it's cli interface, and it's installation directory
/// relative to the binary /// relative to the binary
pub trait Cmd: fmt::Debug + Sync { pub trait Cmd: Sync {
/// Defines the cli of the applet /// Defines the cli of the applet
fn cli(&self) -> clap::Command; fn cli(&self) -> clap::Command;
/// Runs the applet /// Runs the applet

View File

@ -10,7 +10,7 @@ use std::{
path::{Path, PathBuf}, path::{Path, PathBuf},
}; };
#[derive(Debug, Default)] #[derive(Debug)]
pub struct Bootstrap; pub struct Bootstrap;
impl Bootstrap { impl Bootstrap {

View File

@ -1,7 +1,7 @@
use super::Cmd; use super::Cmd;
use clap::Command; use clap::Command;
#[derive(Debug, Default)] #[derive(Debug)]
pub struct Clear; pub struct Clear;
impl Cmd for Clear { impl Cmd for Clear {

View File

@ -13,16 +13,15 @@ mod utilbox;
/// Parses a string into a command to run /// Parses a string into a command to run
#[must_use] #[must_use]
#[allow(clippy::box_default)]
pub fn get(name: &str) -> Option<Box<dyn Cmd>> { pub fn get(name: &str) -> Option<Box<dyn Cmd>> {
match name { match name {
"bootstrap" => Some(Box::new(bootstrap::Bootstrap::default())), "bootstrap" => Some(Box::new(bootstrap::Bootstrap)),
"clear" => Some(Box::new(clear::Clear::default())), "clear" => Some(Box::new(clear::Clear)),
"mountpoint" => Some(Box::new(mountpoint::Mountpoint::default())), "mountpoint" => Some(Box::new(mountpoint::Mountpoint)),
"swaplabel" => Some(Box::new(swaplabel::Swaplabel::default())), "swaplabel" => Some(Box::new(swaplabel::Swaplabel)),
"swapoff" => Some(Box::new(swapoff::Swapoff::default())), "swapoff" => Some(Box::new(swapoff::Swapoff)),
"umount" => Some(Box::new(umount::Umount::default())), "umount" => Some(Box::new(umount::Umount)),
"utilbox" => Some(Box::new(utilbox::Utilbox::default())), "utilbox" => Some(Box::new(utilbox::Utilbox)),
_ => None, _ => None,
} }
} }

View File

@ -1,7 +1,7 @@
use clap::{ArgMatches, Command}; use clap::{ArgMatches, Command};
use shitbox::Cmd; use shitbox::Cmd;
#[derive(Debug, Default)] #[derive(Debug)]
pub struct Mount; pub struct Mount;
impl Cmd for Mount { impl Cmd for Mount {

View File

@ -9,7 +9,7 @@ use std::{
process, process,
}; };
#[derive(Debug, Default)] #[derive(Debug)]
pub struct Mountpoint; pub struct Mountpoint;
impl Cmd for Mountpoint { impl Cmd for Mountpoint {

View File

@ -19,7 +19,7 @@ lazy_static! {
unsafe { libc::sysconf(libc::_SC_PAGESIZE) as u64 - SWAP_MAGIC_LENGTH }; unsafe { libc::sysconf(libc::_SC_PAGESIZE) as u64 - SWAP_MAGIC_LENGTH };
} }
#[derive(Debug, Default)] #[derive(Debug)]
pub struct Swaplabel; pub struct Swaplabel;
impl Cmd for Swaplabel { impl Cmd for Swaplabel {

View File

@ -6,7 +6,7 @@ use std::{
io::{self, BufRead, BufReader}, io::{self, BufRead, BufReader},
}; };
#[derive(Debug, Default)] #[derive(Debug)]
pub struct Swapoff; pub struct Swapoff;
impl Cmd for Swapoff { impl Cmd for Swapoff {

View File

@ -3,7 +3,7 @@ use mount::MntEntries;
use shitbox::{args, Cmd}; use shitbox::{args, Cmd};
use std::io; use std::io;
#[derive(Debug, Default)] #[derive(Debug)]
pub struct Umount; pub struct Umount;
impl Cmd for Umount { impl Cmd for Umount {

View File

@ -3,7 +3,7 @@ use clap::Command;
use shitbox::Cmd; use shitbox::Cmd;
use std::{error::Error, process}; use std::{error::Error, process};
#[derive(Debug, Default)] #[derive(Debug)]
pub struct Utilbox; pub struct Utilbox;
impl Cmd for Utilbox { impl Cmd for Utilbox {