feat: add true and false
This commit is contained in:
parent
eeda98e41c
commit
c16858fd8d
4 changed files with 24 additions and 0 deletions
10
coreutils/src/commands/false.rs
Normal file
10
coreutils/src/commands/false.rs
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
use boxutils::commands::Command;
|
||||||
|
use std::process::exit;
|
||||||
|
|
||||||
|
pub struct False;
|
||||||
|
|
||||||
|
impl Command for False {
|
||||||
|
fn execute(&self) {
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -11,3 +11,5 @@ command!(echo::Echo);
|
||||||
command!(mkdir::Mkdir);
|
command!(mkdir::Mkdir);
|
||||||
command!(dd::Dd);
|
command!(dd::Dd);
|
||||||
command!(nproc::Nproc);
|
command!(nproc::Nproc);
|
||||||
|
command!(r#true::True);
|
||||||
|
command!(r#false::False);
|
||||||
|
|
|
||||||
10
coreutils/src/commands/true.rs
Normal file
10
coreutils/src/commands/true.rs
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
use boxutils::commands::Command;
|
||||||
|
use std::process::exit;
|
||||||
|
|
||||||
|
pub struct True;
|
||||||
|
|
||||||
|
impl Command for True {
|
||||||
|
fn execute(&self) {
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -11,6 +11,8 @@ pub fn get_registry() -> CommandRegistry {
|
||||||
registry.register("ash", Box::new(shell::ash::Ash));
|
registry.register("ash", Box::new(shell::ash::Ash));
|
||||||
registry.register("dd", Box::new(coreutils::commands::Dd));
|
registry.register("dd", Box::new(coreutils::commands::Dd));
|
||||||
registry.register("nproc", Box::new(coreutils::commands::Nproc));
|
registry.register("nproc", Box::new(coreutils::commands::Nproc));
|
||||||
|
registry.register("true", Box::new(coreutils::commands::True));
|
||||||
|
registry.register("false", Box::new(coreutils::commands::False));
|
||||||
registry.register("box", Box::new(Boxcmd));
|
registry.register("box", Box::new(Boxcmd));
|
||||||
|
|
||||||
registry
|
registry
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue