gshell 1.0.2

gshell is a shell for people who live in the terminal. It pairs familiar Unix behavior with a tighter core, fast interaction, and an interface built to stay out of the way.
Documentation
use reedline::{ValidationResult, Validator};

use crate::parser::{ParseErrorKind, Parser};

#[derive(Debug, Default)]
pub struct ParserValidator {
    parser: Parser,
}

impl Validator for ParserValidator {
    fn validate(&self, line: &str) -> ValidationResult {
        match self.parser.parse(line) {
            Ok(_) => ValidationResult::Complete,
            Err(err) => match err.kind {
                ParseErrorKind::Incomplete => ValidationResult::Incomplete,
                ParseErrorKind::Invalid => ValidationResult::Complete,
            },
        }
    }
}