Explorar o código

Add render() implementation for SubdirGitRepo (#730)

	modified:   src/output/render/git.rs
alpn %!s(int64=5) %!d(string=hai) anos
pai
achega
d0470d39ae
Modificáronse 1 ficheiros con 12 adicións e 0 borrados
  1. 12 0
      src/output/render/git.rs

+ 12 - 0
src/output/render/git.rs

@@ -16,6 +16,18 @@ impl f::Git {
     }
 }
 
+impl f::SubdirGitRepo {
+    pub fn render(self, colours: &dyn Colours) -> TextCell {
+        let style = ansi_term::Style::new();
+            match self.status{
+                f::SubdirGitRepoStatus::NotDir => (),
+                f::SubdirGitRepoStatus::NotRepo => (),
+                f::SubdirGitRepoStatus::GitClean => return TextCell::paint_str(style.bold().fg(ansi_term::Color::Green), "V"),
+                f::SubdirGitRepoStatus::GitDirty => return TextCell::paint_str(style.bold().fg(ansi_term::Color::Red), "X"),
+            }
+        TextCell::blank(style)
+        }
+}
 
 impl f::GitStatus {
     fn render(self, colours: &dyn Colours) -> ANSIString<'static> {