1
0
Fork 0
trinitrix/src/main.rs

59 lines
1.7 KiB
Rust

/*
* Copyright (C) 2024 - 2024:
* The Trinitrix Project <benedikt.peetz@b-peetz.de, antifallobst@systemausfall.org, sils@sils.li>
* SPDX-License-Identifier: GPL-3.0-or-later
*
* This file is part of Trinitrix.
*
* Trinitrix is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation, either version 3 of the License,
* or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
mod app;
mod cli;
mod ui;
use anyhow::Context;
use clap::Parser;
use crate::{
cli::{Args, Command},
ui::{repl::Repl, tui::Tui},
};
#[tokio::main]
async fn main() -> anyhow::Result<()> {
cli_log::init_cli_log!();
let args = Args::parse();
match args.subcommand {
Command::Tui {} => {
let mut app = app::App::new(Tui::new().context("Failed to setup tui")?)?;
// NOTE(@soispha): The `None` here is temporary <2024-05-08>
app.run(None, args.plugin_path).await?;
}
Command::Repl {} => {
let mut app = app::App::new(Repl::new().context("Failed to setup repl")?)?;
// NOTE(@soispha): The `None` here is temporary <2024-05-03>
app.run(None, args.plugin_path).await?;
}
};
Ok(())
}
// FIXME(@soispha): Re-exports for trixy, this should be configurable <2024-05-03>
pub use crate::app::command_interface::*;