diff --git a/src/command/command_builder.rs b/src/command/command_builder.rs index 6b409bb..69a476c 100644 --- a/src/command/command_builder.rs +++ b/src/command/command_builder.rs @@ -7,13 +7,8 @@ pub struct CommandBuilder { } impl CommandBuilder { - pub fn new() -> Self { - Self { argv: Vec::new() } - } - - pub fn argv(&mut self, argv: Vec) -> &Self { - self.argv = argv; - self + pub fn new(argv: Vec) -> Self { + Self { argv } } pub fn build(&self) -> Box { diff --git a/src/parser.rs b/src/parser.rs index 98d9831..d258fbb 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -5,7 +5,7 @@ pub fn parse_command_line(line: String) -> Option { let argv: Vec = 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