command_builder : suppression fonction argv inutile

This commit is contained in:
Ahurac 2024-04-12 10:23:21 +02:00
parent 3fd8e3289d
commit bb31375d25
2 changed files with 3 additions and 8 deletions

View file

@ -7,13 +7,8 @@ pub struct CommandBuilder {
}
impl CommandBuilder {
pub fn new() -> Self {
Self { argv: Vec::new() }
}
pub fn argv(&mut self, argv: Vec<String>) -> &Self {
self.argv = argv;
self
pub fn new(argv: Vec<String>) -> Self {
Self { argv }
}
pub fn build(&self) -> Box<dyn Command> {

View file

@ -5,7 +5,7 @@ pub fn parse_command_line(line: String) -> Option<CommandSequence> {
let argv: Vec<String> = line.split_whitespace().map(|s| s.to_string()).collect();
if !argv.is_empty() {
let command = CommandBuilder::new().argv(argv).build();
let command = CommandBuilder::new(argv).build();
Some(CommandSequence::new(command))
} else {
None