1
0
Fork 0
trinitrix/src/main.rs

59 lines
1.7 KiB
Rust
Raw Normal View History

/*
* 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;
2024-05-04 15:43:30 +00:00
use crate::{
cli::{Args, Command},
ui::{repl::Repl, tui::Tui},
2024-05-04 15:43:30 +00:00
};
2023-06-14 21:49:20 +00:00
#[tokio::main]
async fn main() -> anyhow::Result<()> {
2023-07-01 10:44:11 +00:00
cli_log::init_cli_log!();
let args = Args::parse();
2024-05-08 18:14:15 +00:00
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?;
}
2024-05-04 15:43:30 +00:00
Command::Repl {} => {
let mut app = app::App::new(Repl::new().context("Failed to setup repl")?)?;
2024-05-04 15:43:30 +00:00
// NOTE(@soispha): The `None` here is temporary <2024-05-03>
app.run(None, args.plugin_path).await?;
}
};
2023-06-14 21:49:20 +00:00
Ok(())
}
// FIXME(@soispha): Re-exports for trixy, this should be configurable <2024-05-03>
pub use crate::app::command_interface::*;