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-06 14:29:15 +00:00
|
|
|
* This program 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-06 14:29:15 +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-06 14:29:15 +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},
|
|
|
|
ui::repl::Repl,
|
|
|
|
};
|
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();
|
2023-07-24 21:38:16 +00:00
|
|
|
let command = args.subcommand.unwrap_or(Command::Start {});
|
2023-07-23 13:53:31 +00:00
|
|
|
match command {
|
|
|
|
Command::Start {} => {
|
2024-05-04 15:43:30 +00:00
|
|
|
todo!("The full ui is not yet finished");
|
2024-05-04 18:05:05 +00:00
|
|
|
let mut app = app::App::new(Repl::new()?)?;
|
2024-05-04 13:00:58 +00:00
|
|
|
|
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?;
|
|
|
|
}
|
|
|
|
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::*;
|