Skip to content

Commit

Permalink
Display expired status in command prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
sam701 committed Mar 3, 2020
1 parent c994bd5 commit f22d6e9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "awscredx"
version = "0.8.1"
version = "0.8.2"
authors = ["Alexei Samokvalov <[email protected]>"]
edition = "2018"

Expand Down
10 changes: 6 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!("[{} {}]",
Expand All @@ -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)
}
}
Expand Down

0 comments on commit f22d6e9

Please sign in to comment.