feat: add true and false

This commit is contained in:
Teesh 2025-03-24 15:00:14 +02:00
parent eeda98e41c
commit c16858fd8d
4 changed files with 24 additions and 0 deletions

View 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);
}
}

View file

@ -11,3 +11,5 @@ command!(echo::Echo);
command!(mkdir::Mkdir);
command!(dd::Dd);
command!(nproc::Nproc);
command!(r#true::True);
command!(r#false::False);

View 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);
}
}

View file

@ -11,6 +11,8 @@ pub fn get_registry() -> CommandRegistry {
registry.register("ash", Box::new(shell::ash::Ash));
registry.register("dd", Box::new(coreutils::commands::Dd));
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