|
@ -5,11 +5,11 @@ use crate::builtins::{execute_builtin, is_builtin}; |
|
|
use crate::error::ShellError;
|
|
|
use crate::error::ShellError;
|
|
|
use crate::parse::parse_line;
|
|
|
use crate::parse::parse_line;
|
|
|
|
|
|
|
|
|
pub fn interpret(line: &str) -> Result<(), ShellError> {
|
|
|
|
|
|
|
|
|
pub fn interpret(line: String) -> Result<(), ShellError> {
|
|
|
if line.is_empty() {
|
|
|
if line.is_empty() {
|
|
|
return Err(ShellError::EmptyLine);
|
|
|
return Err(ShellError::EmptyLine);
|
|
|
}
|
|
|
}
|
|
|
let (keyword, args) = parse_line(line)?;
|
|
|
|
|
|
|
|
|
let (keyword, args) = parse_line(&line)?;
|
|
|
|
|
|
|
|
|
if is_builtin(keyword) {
|
|
|
if is_builtin(keyword) {
|
|
|
execute_builtin(keyword, args)?;
|
|
|
execute_builtin(keyword, args)?;
|
|
|