Files
bbs-md/src/main.rs
T
ruohki bad8fba5aa feat(01-03): implement App struct and event loop with exit behavior
- App struct with is_login_shell, double-press Ctrl+C state machine, show_quit_prompt
- run_event_loop() polls SignalFlags first, then draws, then polls key events
- handle_key() suppresses 'q' in login shell mode; double Ctrl+C within 2s quits
- draw() renders Phase 1 placeholder TUI with title, welcome text, quit prompt
- show_goodbye() prints BBS-style goodbye with 500ms delay after terminal restore
- DOUBLE_PRESS_WINDOW const = 2 seconds
- mod app added to main.rs
2026-02-28 21:17:10 +01:00

28 lines
820 B
Rust

mod app;
mod config;
mod signals;
mod terminal;
fn main() {
// 1. Detect login shell BEFORE stripping argv[0]
let is_login_shell = config::detect_login_shell();
// 2. Parse CLI (strips dash from argv[0] internally)
let cli = config::parse_cli();
// 3. Resolve config path and load config
let config_path = config::resolve_config_path(cli.config.as_deref());
let app_config = match config::load_config(&config_path) {
Ok(c) => c,
Err(e) => {
config::print_config_error(&e);
std::process::exit(1);
}
};
// Phase 1 placeholder: print loaded config for verification
// This will be replaced by terminal init + event loop in Plan 03
println!("Config loaded: {:?}", app_config);
println!("Login shell: {}", is_login_shell);
}