From d756afbc065976a649e741096cf78d2cb29cfcf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Silas=20Sch=C3=B6ffel?= Date: Wed, 8 May 2024 20:14:15 +0200 Subject: [PATCH] fix(ui): default to help message --- src/cli.rs | 8 ++++---- src/main.rs | 11 ++--------- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/src/cli.rs b/src/cli.rs index 020de29..fb47d2c 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -25,11 +25,11 @@ use clap::{Parser, Subcommand}; /// A multi protocol chat client #[derive(Parser, Debug)] -#[command(author, version, about, long_about = None)] +#[command(author, version, about, long_about = None, arg_required_else_help(true))] pub struct Args { #[command(subcommand)] - /// The subcommand to execute, default is start - pub subcommand: Option, + /// The subcommand to execute, default is help + pub subcommand: Command, // #[arg(long, short)] // /// Path to the Lua config file, executed instead of the normal one @@ -41,7 +41,7 @@ pub struct Args { #[derive(Subcommand, Debug)] pub enum Command { /// Starts the main TUI client - Start {}, + Tui {}, /// Starts a repl to the trinitry cli interpreter Repl {}, diff --git a/src/main.rs b/src/main.rs index 1bd6508..38431b0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -36,15 +36,8 @@ async fn main() -> anyhow::Result<()> { cli_log::init_cli_log!(); let args = Args::parse(); - let command = args.subcommand.unwrap_or(Command::Start {}); - match command { - Command::Start {} => { - todo!("The full ui is not yet finished"); - let mut app = app::App::new(Repl::new()?)?; - - // NOTE(@soispha): The `None` here is temporary <2024-05-03> - app.run(None, args.plugin_path).await?; - } + match args.subcommand { + Command::Tui {} => {} Command::Repl {} => { let mut app = app::App::new(Repl::new().context("Failed to setup repl")?)?;