diff --git a/Cargo.toml b/Cargo.toml index 4c90962..a8a501d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,4 +8,4 @@ authors = ["HARSHIT VIJAY"] colored = "2.0" sysinfo = "0.30" whoami = "0.9" -clap = { version = "4.5", features = ["derive"] } +clap = { version = "4.5", features = ["derive"] } \ No newline at end of file diff --git a/assets/logo.txt b/assets/logo.txt new file mode 100644 index 0000000..5ac1516 --- /dev/null +++ b/assets/logo.txt @@ -0,0 +1,6 @@ + ___ ____ _ + / _ \/ ___| _ __ ___ ___| |_ +| | | \___ \| '_ \ / _ \/ __| __| +| |_| |___) | |_) | __/ (__| |_ + \___/|____/| .__/ \___|\___|\__| + |_| diff --git a/src/main.rs b/src/main.rs index 2cde51c..8795e98 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,6 +2,19 @@ use colored::*; use clap::Command; use sysinfo::{CpuRefreshKind, RefreshKind, System ,Networks}; use whoami; +use std::{env, fs}; +use std::path::PathBuf; + +fn get_logo_path() -> PathBuf { + let mut project_root_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap_or_default()); + project_root_dir.push("assets"); + project_root_dir.push("logo.txt"); + project_root_dir +} + +fn read_logo(path: PathBuf) -> String { + fs::read_to_string(path).unwrap_or_else(|_| "Logo not found".red().to_string())} + fn format_uptime(uptime: u64) -> String { let (secs, mins, hours, days) = (uptime % 60, (uptime / 60) % 60, (uptime / 3600) % 24, uptime / (3600 * 24)); @@ -58,8 +71,14 @@ fn main() { ) .get_matches(); - // Handle subcommands or default behavior + // Read ASCII logo + let logo_path = get_logo_path(); + let logo = read_logo(logo_path); + println!("{}", logo); // Display the logo + + + // Handle subcommands or default behavior match matches.subcommand() { Some(("all", _)) => { // println!("'all' subcommand used"); @@ -138,4 +157,4 @@ fn print_os_info() { println!("{}: {}", "Kernel Version".blue(), sysinfo::System::kernel_version().unwrap_or_default()); println!("{}: {}", "System Uptime".blue(), format_uptime(sysinfo::System::uptime())); // Add more OS info as needed -} +} \ No newline at end of file