2024-05-04 18:55:52 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2024 - 2024:
|
2024-05-06 14:29:15 +00:00
|
|
|
* The Trinitrix Project <benedikt.peetz@b-peetz.de, antifallobst@systemausfall.org, sils@sils.li>
|
|
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
2024-05-04 18:55:52 +00:00
|
|
|
*
|
|
|
|
* This file is part of Trinitrix.
|
|
|
|
*
|
2024-05-08 19:18:29 +00:00
|
|
|
* 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.
|
2024-05-04 18:55:52 +00:00
|
|
|
*
|
2024-05-08 19:18:29 +00:00
|
|
|
* 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.
|
2024-05-04 18:55:52 +00:00
|
|
|
*
|
2024-05-08 19:18:29 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2024-05-04 18:55:52 +00:00
|
|
|
*/
|
|
|
|
|
2023-09-20 17:22:56 +00:00
|
|
|
mod app;
|
2023-07-23 13:53:31 +00:00
|
|
|
mod cli;
|
2023-09-20 17:22:56 +00:00
|
|
|
mod ui;
|
2023-07-23 13:53:31 +00:00
|
|
|
|
2024-05-04 18:05:05 +00:00
|
|
|
use anyhow::Context;
|
2023-07-23 13:53:31 +00:00
|
|
|
use clap::Parser;
|
|
|
|
|
2024-05-04 15:43:30 +00:00
|
|
|
use crate::{
|
|
|
|
cli::{Args, Command},
|
2024-05-08 20:06:36 +00:00
|
|
|
ui::{repl::Repl, tui::Tui},
|
2024-05-04 15:43:30 +00:00
|
|
|
};
|
2023-06-14 21:49:20 +00:00
|
|
|
|
2023-06-15 17:19:24 +00:00
|
|
|
#[tokio::main]
|
|
|
|
async fn main() -> anyhow::Result<()> {
|
2023-07-01 10:44:11 +00:00
|
|
|
cli_log::init_cli_log!();
|
2023-06-15 17:19:24 +00:00
|
|
|
|
2023-07-23 13:53:31 +00:00
|
|
|
let args = Args::parse();
|
2024-05-08 18:14:15 +00:00
|
|
|
match args.subcommand {
|
2024-05-08 20:06:36 +00:00
|
|
|
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 {} => {
|
2024-05-04 18:05:05 +00:00
|
|
|
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>
|
2024-05-04 13:00:58 +00:00
|
|
|
app.run(None, args.plugin_path).await?;
|
2023-07-23 13:53:31 +00:00
|
|
|
}
|
|
|
|
};
|
2023-06-14 21:49:20 +00:00
|
|
|
|
|
|
|
Ok(())
|
|
|
|
}
|
2024-05-03 19:25:09 +00:00
|
|
|
|
|
|
|
// FIXME(@soispha): Re-exports for trixy, this should be configurable <2024-05-03>
|
|
|
|
pub use crate::app::command_interface::*;
|