From bf92de25b652fb22a7a80f146be94183c7b4dc4f Mon Sep 17 00:00:00 2001 From: Ahurac Date: Thu, 11 Apr 2024 19:07:12 +0200 Subject: [PATCH] Ajout : module `command_builder` --- src/command/command_builder.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/command/command_builder.rs diff --git a/src/command/command_builder.rs b/src/command/command_builder.rs new file mode 100644 index 0000000..b7e88be --- /dev/null +++ b/src/command/command_builder.rs @@ -0,0 +1,23 @@ +use super::unix_program::UnixProgram; +use super::Command; + +pub struct CommandBuilder { + argv: Vec, +} + +impl CommandBuilder { + pub fn new() -> Self { + Self { argv: Vec::new() } + } + + pub fn argv(&mut self, argv: Vec) -> &Self { + self.argv = argv; + self + } + + pub fn build(&self) -> impl Command { + let command = UnixProgram::new(&self.argv); + + command + } +}