From f22d6e90f0409b2e163fd790f95282319b57b7f2 Mon Sep 17 00:00:00 2001 From: Alexei Samokvalov Date: Tue, 3 Mar 2020 11:57:55 +0100 Subject: [PATCH] Display expired status in command prompt --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/main.rs | 10 ++++++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e05ca95..6f6bf92 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -63,7 +63,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "awscredx" -version = "0.8.1" +version = "0.8.2" dependencies = [ "ansi_term 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)", "chrono 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/Cargo.toml b/Cargo.toml index dd20def..b7d2c4c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "awscredx" -version = "0.8.1" +version = "0.8.2" authors = ["Alexei Samokvalov "] edition = "2018" diff --git a/src/main.rs b/src/main.rs index 60f97fc..33f0514 100644 --- a/src/main.rs +++ b/src/main.rs @@ -157,10 +157,8 @@ fn print_prompt() { let duration = ex - Utc::now(); let expiration_style = if duration > Duration::minutes(10) { Style::new().fg(Color::Green) - } else if duration > Duration::minutes(5) { - Style::new().fg(Color::Yellow).bold() } else { - Style::new().fg(Color::Red).bold() + Style::new().fg(Color::Yellow).bold() }; if duration > Duration::zero() { print!("[{} {}]", @@ -169,7 +167,11 @@ fn print_prompt() { ) } } - Ok(None) => {} + Ok(None) => + print!("[{} {}]", + Style::new().fg(Color::White).bold().paint(profile).to_string(), + Style::new().fg(Color::Red).bold().paint("expired").to_string(), + ), Err(e) => eprintln!("ERROR: {}", e) } }