Skip to content

Commit

Permalink
Ignore username when empty or unset
Browse files Browse the repository at this point in the history
  • Loading branch information
pablodiegoss committed Oct 23, 2019
1 parent 1fb086f commit daa59b4
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,13 @@ impl std::fmt::Display for Info {
None => Color::White,
};
if !self.disable_fields.git_info{
let mut git_info = String::from(&self.git_username);
let username = if self.git_username == "" {
String::from("")
}else{
String::from(format!("{}:",self.git_username))
};

git_info.push(':');
git_info.push_str(&self.git_version);
let git_info = format!("{}{}", username, self.git_version);
write_buf(&mut buf, "", &git_info, color)?;

let separator = "-".repeat(git_info.len());
Expand Down

0 comments on commit daa59b4

Please sign in to comment.