diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main.rs | 103 |
1 files changed, 79 insertions, 24 deletions
diff --git a/src/main.rs b/src/main.rs index 8bb668f..20ca930 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,31 +1,86 @@ -use eframe::egui; - -fn main() -> Result<(), eframe::Error> { - let options = eframe::NativeOptions { - viewport: egui::ViewportBuilder::default().with_inner_size([320.0, 240.0]), - ..Default::default() - }; - - eframe::run_native( - "Hello World", - options, - Box::new(|_cc| Ok(Box::new(MyApp::default()))), - ) -} +use eyre::Result; +use rustyline::DefaultEditor; +use std::path::PathBuf; -struct MyApp; +fn main() -> Result<()> { + color_eyre::install()?; -impl Default for MyApp { - fn default() -> Self { - Self + let mut rl = DefaultEditor::new()?; + loop { + let line = rl.readline(">>> ")?; + println!("{line}"); } + + Ok(()) +} + +enum FileSpec { + Con, + Path(PathBuf), +} + +enum Command { + Pipe { left: Box<Command>, right: Box<Command> }, + Redirect { command: Box<Command>, target: FileSpec }, + External { program: String, args: Vec<String> }, + 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 eframe::App for MyApp { - fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) { - egui::CentralPanel::default().show(ctx, |ui| { - ui.heading("Hello World!"); - ui.label("This is a simple egui application."); - }); +impl Command { + fn parse(_input: &str) -> Result<Command> { + Err(eyre::eyre!("Not implemented")) } } |