summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/repl/mod.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/repl/mod.rs b/src/repl/mod.rs
index 69056ac..4825b93 100644
--- a/src/repl/mod.rs
+++ b/src/repl/mod.rs
@@ -84,10 +84,12 @@ impl Repl {
}
fn handle_line(&mut self, handler: Arc<ReplCmdHandler>, line: String) -> Result<bool> {
- if line.starts_with('.') {
- let (cmd, args) = match line.split_once(' ') {
- Some((head, tail)) => (head, Some(tail.trim())),
- None => (line.as_str(), None),
+ let mut trimed_line = line.trim_start();
+ if trimed_line.starts_with('.') {
+ trimed_line = trimed_line.trim_end();
+ let (cmd, args) = match trimed_line.split_once(' ') {
+ Some((head, tail)) => (head, Some(tail)),
+ None => (trimed_line, None),
};
match cmd {
".exit" => {