2023-07-04 03:58:25 +00:00
|
|
|
use std::{error::Error, time::Duration};
|
|
|
|
|
|
|
|
use argh::FromArgs;
|
|
|
|
|
2021-11-11 14:56:37 +00:00
|
|
|
mod app;
|
|
|
|
#[cfg(feature = "crossterm")]
|
|
|
|
mod crossterm;
|
|
|
|
#[cfg(feature = "termion")]
|
|
|
|
mod termion;
|
2023-05-12 15:58:01 +00:00
|
|
|
#[cfg(feature = "termwiz")]
|
|
|
|
mod termwiz;
|
|
|
|
|
2021-11-11 14:56:37 +00:00
|
|
|
mod ui;
|
|
|
|
|
|
|
|
/// Demo
|
|
|
|
#[derive(Debug, FromArgs)]
|
|
|
|
struct Cli {
|
|
|
|
/// time in ms between two ticks.
|
|
|
|
#[argh(option, default = "250")]
|
|
|
|
tick_rate: u64,
|
|
|
|
/// whether unicode symbols are used to improve the overall look of the app
|
|
|
|
#[argh(option, default = "true")]
|
|
|
|
enhanced_graphics: bool,
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() -> Result<(), Box<dyn Error>> {
|
|
|
|
let cli: Cli = argh::from_env();
|
|
|
|
let tick_rate = Duration::from_millis(cli.tick_rate);
|
2023-07-04 03:58:25 +00:00
|
|
|
#[cfg(feature = "crossterm")]
|
|
|
|
crate::crossterm::run(tick_rate, cli.enhanced_graphics)?;
|
|
|
|
#[cfg(feature = "termion")]
|
|
|
|
crate::termion::run(tick_rate, cli.enhanced_graphics)?;
|
|
|
|
#[cfg(feature = "termwiz")]
|
|
|
|
crate::termwiz::run(tick_rate, cli.enhanced_graphics)?;
|
2021-11-11 14:56:37 +00:00
|
|
|
Ok(())
|
|
|
|
}
|