error : délocalisation de l'erreur UnmatchedQuoteError

This commit is contained in:
Ahurac 2024-04-17 16:15:35 +02:00
parent 9d53bdba0c
commit a50bea4c60
2 changed files with 10 additions and 3 deletions

View file

@ -41,6 +41,16 @@ impl Display for CommandNotFoundError {
}
}
pub struct UnmatchedQuoteError {
index: usize,
}
impl Display for UnmatchedQuoteError {
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
write!(f, "unmatched quote at character {}", self.index)
}
}
pub fn print(error: Error) {
let name = env::args().next().unwrap_or(String::from("rash"));
let name = Path::new(&name).file_name().unwrap().to_str().unwrap();

View file

@ -106,6 +106,3 @@ pub fn parse(line: String, variables: &Variables) -> CommandSequence {
command_sequence
}
#[derive(Debug)]
struct UnmatchedQuoteError;