rash/src/parser.rs

13 lines
433 B
Rust

use crate::command::command_builder::CommandBuilder;
use crate::command::command_sequence::CommandSequence;
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();
Some(CommandSequence::new(command))
} else {
None
}
}