error : délocalisation de l'erreur UnmatchedQuoteError
This commit is contained in:
parent
9d53bdba0c
commit
a50bea4c60
2 changed files with 10 additions and 3 deletions
10
src/error.rs
10
src/error.rs
|
@ -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();
|
||||
|
|
|
@ -106,6 +106,3 @@ pub fn parse(line: String, variables: &Variables) -> CommandSequence {
|
|||
|
||||
command_sequence
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
struct UnmatchedQuoteError;
|
||||
|
|
Loading…
Reference in a new issue