Factor out TUI code.

This commit is contained in:
Shaun Reed 2025-04-13 12:17:11 -04:00
parent fd3c8fb204
commit f4242f7749
2 changed files with 8 additions and 6 deletions

View File

@ -5,11 +5,7 @@ use std::process::{Command, Stdio};
use structopt::StructOpt; use structopt::StructOpt;
pub mod gui; pub mod gui;
pub mod tui;
fn run_tui(root_path: std::path::PathBuf) -> Result<(), Box<dyn Error>> {
println!("Starting the TUI editor at {:?}", root_path);
Ok(())
}
/// Command line interface IDE with full GUI and headless modes. /// Command line interface IDE with full GUI and headless modes.
/// If no flags are provided the GUI editor is launched in a separate process. /// If no flags are provided the GUI editor is launched in a separate process.
@ -46,7 +42,7 @@ fn main() -> Result<(), Box<dyn Error>> {
true => gui::run(root_path), true => gui::run(root_path),
false => match args.tui { false => match args.tui {
// Open the TUI editor if requested, otherwise use the QML GUI by default. // Open the TUI editor if requested, otherwise use the QML GUI by default.
true => run_tui(root_path), true => tui::run(root_path),
false => { false => {
// Relaunch the CLIDE GUI in a separate process. // Relaunch the CLIDE GUI in a separate process.
Command::new(std::env::current_exe()?) Command::new(std::env::current_exe()?)

6
src/tui.rs Normal file
View File

@ -0,0 +1,6 @@
use std::error::Error;
pub fn run(root_path: std::path::PathBuf) -> Result<(), Box<dyn Error>> {
println!("Starting the TUI editor at {:?}", root_path);
Ok(())
}