diff --git a/CHANGELOG.md b/CHANGELOG.md index bfa21d3b..b8f9e4d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,8 @@ All changes in this project will be noted in this file. ### Fixes -- Added error code output for new error codes which otherwise printed "Unknown error" +- (skysh) Added error code output for new error codes which otherwise printed "Unknown error" +- (skysh) Fixed handling of EOF keystroke ## Version 0.7.4 diff --git a/cli/src/argparse.rs b/cli/src/argparse.rs index ac74cd08..f0ba4b92 100644 --- a/cli/src/argparse.rs +++ b/cli/src/argparse.rs @@ -24,21 +24,17 @@ * */ -use crate::runner::Runner; -use crate::tokenizer; -use clap::load_yaml; -use clap::App; -use crossterm::terminal::{Clear, ClearType}; -use crossterm::{cursor, execute}; -use libsky::URL; -use libsky::VERSION; -use readline::config::Configurer; -use readline::{error::ReadlineError, Editor}; +use crate::{runner::Runner, tokenizer}; +use clap::{load_yaml, App}; +use crossterm::{ + cursor, execute, + terminal::{Clear, ClearType}, +}; +use libsky::{URL, VERSION}; +use readline::{config::Configurer, error::ReadlineError, Editor}; use rustyline as readline; -use skytable::Pipeline; -use skytable::Query; -use std::io::stdout; -use std::process; +use skytable::{Pipeline, Query}; +use std::{io::stdout, process}; const ADDR: &str = "127.0.0.1"; const SKYSH_HISTORY_FILE: &str = ".sky_history"; @@ -155,7 +151,7 @@ pub async fn start_repl() { match editor.load_history(SKYSH_HISTORY_FILE) { Ok(_) => {} Err(e) => match e { - rustyline::error::ReadlineError::Io(e) if e.kind() == std::io::ErrorKind::NotFound => { + ReadlineError::Io(e) if e.kind() == std::io::ErrorKind::NotFound => { println!("{}", SKY_WELCOME) } _ => fatal!("Failed to read history file with error: {}", e), @@ -251,7 +247,7 @@ pub async fn start_repl() { } } } - Err(ReadlineError::Interrupted) => break, + Err(ReadlineError::Interrupted | ReadlineError::Eof) => break, Err(err) => fatal!("ERROR: Failed to read line with error: {}", err), } }