From 2bf65b957b75d3b4ead5ad4236c26cb8f3c9bae2 Mon Sep 17 00:00:00 2001 From: candifloss Date: Wed, 14 Aug 2024 03:19:45 +0530 Subject: [PATCH] commit --- .gitignore | 1 + Cargo.lock | 92 +++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main.rs | 45 ++++++++++++++++++++++++++ 3 files changed, 138 insertions(+) create mode 100644 .gitignore create mode 100644 Cargo.lock create mode 100644 src/main.rs diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ea8c4bf --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/target diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..932f2f8 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,92 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "colored" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbf2150cce219b664a8a70df7a1f933836724b503f8a413af9365b4dcc4d90b8" +dependencies = [ + "lazy_static", + "windows-sys", +] + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + +[[package]] +name = "prettyprompt" +version = "0.1.0" +dependencies = [ + "colored", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..8228dd6 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,45 @@ +use std::env::current_dir as current_dir; +//use std::env::var_os as var_os; +use std::env::args as args; +use colored::Colorize; + +fn main() -> std::io::Result<()> { + let angle = "❯"; + let pwd = current_dir()?; + let dir = pwd.display().to_string(); + let args: Vec = args().collect(); + let shell: String; + + if args.len() > 1 { + shell = args[1].clone(); + } + else { + shell = "none".to_string(); + } + + let shell_char = match shell.as_str() { + "bash" => "", + "zsh" => "󰰶", + "fish" => "󰈺", + "nushell" => "", + "ion" => "", + _ => "󱆃", + }; + + /* + match var_os(USER).as_str() { + "root" => { + shell_char = shell_char.truecolor(255,53,94); + }, + _ => { + shell_char = shell_char.truecolor(54,178,91); + } + }*/ + + print!("{} {}{} ", + shell_char.truecolor(75,75,75), + dir.italic().truecolor(75,75,75), + angle.truecolor(0, 255, 180), + ); + Ok(()) +}