use eyre::Result; use rustyline::DefaultEditor; use std::path::PathBuf; fn main() -> Result<()> { color_eyre::install()?; let mut rl = DefaultEditor::new()?; loop { let line = rl.readline(">>> ")?; println!("{line}"); } Ok(()) } enum FileSpec { Con, Path(PathBuf), } enum Command { Pipe { left: Box, right: Box }, Redirect { command: Box, target: FileSpec }, External { program: String, args: Vec }, Builtin { name: BuiltinCommand }, } enum BuiltinCommand { // File-oriented Type { file: FileSpec }, Copy { from: FileSpec, to: FileSpec }, Xcopy { from: FileSpec, to: FileSpec, recursive: bool }, Mkdir { path: PathBuf }, Remove { path: PathBuf }, Rmdir { path: PathBuf }, Rename { from: FileSpec, to: FileSpec }, Dir { path: PathBuf }, Tree { path: PathBuf }, // Shell-oriented PromptGet, PromptSet { message: String }, EchoText { message: String }, EchoOn, EchoOff, EchoPlain, Exit, Set { name: String, value: String }, Chdir { path: PathBuf }, PathGet, PathSet { value: String }, Ver, // Scripting Rem { message: String }, // Utilities Date, Time, // Screen-oriented Cls, // Dummies Verify, // For later Assign, Join, Subst, Truename, Mem, // For much later, if ever Break, Chcp, Ctty, Vol, } impl Command { fn parse(_input: &str) -> Result { Err(eyre::eyre!("Not implemented")) } }