Skip to content

Commit cc6a9c8

Browse files
committed
Update usage of write_buf and colors
1 parent 419a32b commit cc6a9c8

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

Diff for: src/info.rs

+8-10
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,15 @@ impl std::fmt::Display for Info {
4343
None => Color::White,
4444
};
4545
if !self.disable_fields.git_info{
46-
let username = if self.git_username == "" {
47-
String::from("")
48-
}else{
49-
format!("{}:",self.git_username)
50-
};
51-
52-
let git_info = format!("{}{}", username, self.git_version);
53-
write_buf(&mut buf, "", &git_info, color)?;
54-
46+
let git_info;
47+
if self.git_username != "" {
48+
git_info = format!("{} : {}", self.git_username, self.git_version);
49+
} else {
50+
git_info = self.git_version.clone();
51+
}
52+
write_buf(&mut buf, &self.get_formatted_info_label(&git_info, color), "")?;
5553
let separator = "-".repeat(git_info.len());
56-
write_buf(&mut buf, "", &separator, color)?;
54+
write_buf(&mut buf, &self.get_formatted_info_label("", color), &separator)?;
5755
}
5856
if !self.disable_fields.project {
5957
write_buf(&mut buf, &self.get_formatted_info_label("Project: ", color), &self.project_name)?;

0 commit comments

Comments
 (0)