2024-04-11 19:09:19 +02:00
|
|
|
use crate::command::command_builder::CommandBuilder;
|
2024-04-11 10:16:09 +02:00
|
|
|
use crate::command::command_sequence::CommandSequence;
|
2024-04-10 12:31:29 +02:00
|
|
|
|
2024-04-10 16:43:01 +02:00
|
|
|
pub fn parse_command_line(line: String) -> Option<CommandSequence> {
|
|
|
|
let argv: Vec<String> = line.split_whitespace().map(|s| s.to_string()).collect();
|
2024-04-10 12:31:29 +02:00
|
|
|
|
2024-04-10 16:43:01 +02:00
|
|
|
if !argv.is_empty() {
|
2024-04-11 19:09:19 +02:00
|
|
|
let command = CommandBuilder::new().argv(argv).build();
|
|
|
|
Some(CommandSequence::new(command))
|
2024-04-10 16:43:01 +02:00
|
|
|
} else {
|
|
|
|
None
|
|
|
|
}
|
2024-04-10 12:31:29 +02:00
|
|
|
}
|