Compare commits

..

No commits in common. "62b2dd806558083f296f1996fa4f456f242d38a2" and "3fd8e3289dbb62c15bb98c70bfe7ae49a971bd5d" have entirely different histories.

3 changed files with 8 additions and 4 deletions

View file

@ -17,4 +17,3 @@ I want to learn Rust and see how much effort I can put into making an interopera
- [ ] `type`
- [ ] Command-line flags
- [ ] PS1
- [ ] Execute code from a file

View file

@ -7,8 +7,13 @@ pub struct CommandBuilder {
}
impl CommandBuilder {
pub fn new(argv: Vec<String>) -> Self {
Self { argv }
pub fn new() -> Self {
Self { argv: Vec::new() }
}
pub fn argv(&mut self, argv: Vec<String>) -> &Self {
self.argv = argv;
self
}
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).build();
let command = CommandBuilder::new().argv(argv).build();
Some(CommandSequence::new(command))
} else {
None