From 6a51cf3838cf4c785634ebe5e627304296ece68d Mon Sep 17 00:00:00 2001 From: ykdy3951 Date: Thu, 7 Mar 2024 14:03:27 +0900 Subject: [PATCH 1/3] Add CLLM ASCII art logo to main.rs --- src/main.rs | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 4ae4db6..f9351ad 100644 --- a/src/main.rs +++ b/src/main.rs @@ -5,6 +5,22 @@ use commands::{handle_command, Commands}; use std::env; +const CLLM : &str = r#" + _____ _____ +( ___ )---------------------------------------------( ___ ) + | | | | + | | | | + | | ██████╗██╗ ██╗ ███╗ ███╗ | | + | | ██╔════╝██║ ██║ ████╗ ████║ | | + | | ██║ ██║ ██║ ██╔████╔██║ | | + | | ██║ ██║ ██║ ██║╚██╔╝██║ | | + | | ╚██████╗███████╗███████╗██║ ╚═╝ ██║ | | + | | ╚═════╝╚══════╝╚══════╝╚═╝ ╚═╝ | | + | | | | + |___| |___| +(_____)---------------------------------------------(_____) +"#; + #[derive(Debug, Parser)] #[clap( version, @@ -15,6 +31,9 @@ use std::env; struct Cli { #[clap(subcommand)] pub commands: Commands, + + #[arg(short, long)] + pub vers: bool, } #[tokio::main] @@ -33,10 +52,14 @@ async fn main() { env::set_var("OPENAI_API_KEY", api_key); } } + if env::args().collect::>().len() == 1 { + println!("{}\n Welcome to CLLM! Try running `cllm --help` to get started.\n", CLLM); + return; + } // Parse the command line arguments let cli = Cli::parse(); - + if let Err(_error) = handle_command(cli.commands).await { println!("\n\nError Occurred\n{}", _error.to_string()); } From dddb1118de795e5ff844042f7ddb6bb510a05c3e Mon Sep 17 00:00:00 2001 From: ykdy3951 Date: Thu, 7 Mar 2024 14:08:14 +0900 Subject: [PATCH 2/3] Fix formatting in main.rs --- src/main.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index f9351ad..86f0e50 100644 --- a/src/main.rs +++ b/src/main.rs @@ -5,7 +5,7 @@ use commands::{handle_command, Commands}; use std::env; -const CLLM : &str = r#" +const CLLM: &str = r#" _____ _____ ( ___ )---------------------------------------------( ___ ) | | | | @@ -53,13 +53,16 @@ async fn main() { } } if env::args().collect::>().len() == 1 { - println!("{}\n Welcome to CLLM! Try running `cllm --help` to get started.\n", CLLM); + println!( + "{}\n Welcome to CLLM! Try running `cllm --help` to get started.\n", + CLLM + ); return; } // Parse the command line arguments let cli = Cli::parse(); - + if let Err(_error) = handle_command(cli.commands).await { println!("\n\nError Occurred\n{}", _error.to_string()); } From 53b7b46caa920ebe90d4c1791da35e60c2dec7f8 Mon Sep 17 00:00:00 2001 From: ykdy3951 Date: Sat, 9 Mar 2024 21:52:07 +0900 Subject: [PATCH 3/3] Update error message formatting --- src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 86f0e50..e0c0752 100644 --- a/src/main.rs +++ b/src/main.rs @@ -64,6 +64,6 @@ async fn main() { let cli = Cli::parse(); if let Err(_error) = handle_command(cli.commands).await { - println!("\n\nError Occurred\n{}", _error.to_string()); + println!("\n\nError Occurred\n{}", _error); } }