#![allow(dead_code)]
pub mod command_parser;
pub mod commands;
pub mod completion;
pub mod engine;
pub mod history;
pub mod session;
pub use command_parser::{CommandParser, CommandType, ParsedCommand, SchemaOperation};
pub use completion::CompletionEngine;
pub use engine::{ReplConfig, ReplEngine};
pub use history::HistoryManager;
pub use session::{ReplSession, SessionState};
pub type ReplResult<T> = Result<T, ReplError>;
#[derive(Debug, thiserror::Error)]
pub enum ReplError {
#[error("IO error: {0}")]
Io(#[from] std::io::Error),
#[error("Database error: {0}")]
Database(#[from] anyhow::Error),
#[error("Command parsing error: {0}")]
CommandParsing(String),
#[error("Invalid configuration: {0}")]
Config(String),
#[error("Session error: {0}")]
Session(String),
#[error("History error: {0}")]
History(String),
#[error("Completion error: {0}")]
Completion(String),
#[error("Schema error: {0}")]
SchemaError(String),
#[error("Data directory error: {0}")]
DataDirectoryError(String),
#[error("Unsupported feature: {0}")]
UnsupportedFeature(String),
}
impl ReplError {
pub fn exit_code(&self) -> i32 {
match self {
ReplError::SchemaError(_) => 3,
ReplError::DataDirectoryError(_) => 4,
ReplError::UnsupportedFeature(_) => 5,
_ => 1, }
}
}
#[derive(Debug, Clone, PartialEq)]
pub enum ExecutionResult {
Continue,
Exit,
ExitWithCode(i32),
}
#[derive(Debug, Clone, PartialEq)]
pub enum ReplMode {
Basic,
Tui,
Interactive,
}
#[derive(Debug, Clone, PartialEq)]
pub enum OutputFormat {
Table,
Csv,
Json,
Raw,
}
#[derive(Debug, Clone)]
pub struct CompletionContext {
pub line: String,
pub pos: usize,
pub session_state: SessionState,
pub tables: Vec<String>,
pub keyspaces: Vec<String>,
}