Skip to content

Commit 5b7b42d

Browse files
committed
feat: display error message on unexpected tokens
1 parent 2ba93d3 commit 5b7b42d

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

noshell/src/console.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,14 @@ where
148148
}
149149

150150
// Prepare arguments.
151-
let argv: Vec<_, ARGV_BUFFER_CAPACITY> = line::lexer::split(&line).try_collect()?;
151+
let argv: Vec<_, ARGV_BUFFER_CAPACITY> = match line::lexer::split(&line).try_collect() {
152+
Ok(argv) => argv,
153+
154+
Err(line::lexer::Error::Unexpected(tokens)) => {
155+
noterm::println!(output, "unexpected tokens `{}`", tokens);
156+
return Err(Error::Cancelled);
157+
}
158+
};
152159

153160
self.execute(&argv).await?;
154161
Ok(())

0 commit comments

Comments
 (0)