TUI #1

Merged
shaunrd0 merged 73 commits from ui into master 2026-01-25 20:57:37 +00:00
Showing only changes of commit 7bf6c3299c - Show all commits

View File

@ -1,11 +1,14 @@
// TODO: Header
use cxx_qt_lib::QString;
use std::env;
use std::error::Error;
use std::process::exit;
pub mod colors;
pub mod filesystem;
fn main() {
fn run_gui() -> Result<(), Box<dyn Error>> {
use cxx_qt_lib::{QGuiApplication, QQmlApplicationEngine, QUrl};
let mut app = QGuiApplication::new();
@ -21,4 +24,57 @@ fn main() {
if let Some(app) = app.as_mut() {
app.exec();
}
Ok(())
}
fn run_tui() -> Result<(), Box<dyn Error>> {
println!("Starting TUI editor...");
// Your cursive logic here, like:
// let mut siv = cursive::default();
// siv.add_layer(...);
// siv.run();
Ok(())
}
fn print_help() {
println!("Usage: app_launcher [OPTION]");
println!("Options:");
println!(" gui Launch the QML GUI application");
println!(" tui Launch the TUI text editor (cursive-based)");
println!(" help Show this help message");
}
fn main() {
let args: Vec<String> = env::args().collect();
if args.len() < 2 {
if let Err(e) = run_gui() {
eprintln!("Error launching GUI: {}", e);
exit(1);
}
}
match args.get(1).map(|s| s.as_str()) {
Some("gui") => {
if let Err(e) = run_gui() {
eprintln!("Error launching GUI: {}", e);
exit(1);
}
}
Some("tui") => {
if let Err(e) = run_tui() {
eprintln!("Error launching TUI: {}", e);
exit(1);
}
}
Some("help") | None => {
print_help();
}
Some(arg) => {
eprintln!("Unknown argument: {}", arg);
print_help();
exit(1);
}
}
}