rash/src/parser.rs

15 lines
451 B
Rust
Raw Normal View History

2024-04-10 12:31:29 +02:00
use crate::command::{CommandSequence, UnixProgram};
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
if !argv.is_empty() {
let command = UnixProgram::new(argv);
let command_sequence = CommandSequence::new(command);
// command_sequence.add(_command);
Some(command_sequence)
} else {
None
}
2024-04-10 12:31:29 +02:00
}