|
|
@@ -43,6 +43,8 @@ pub struct Columns {
|
|
|
pub blocks: bool,
|
|
|
pub group: bool,
|
|
|
pub git: bool,
|
|
|
+ pub subdir_git_repos: bool,
|
|
|
+ pub subdir_git_repos_no_stat: bool,
|
|
|
pub octal: bool,
|
|
|
|
|
|
// Defaults to true:
|
|
|
@@ -113,6 +115,14 @@ impl Columns {
|
|
|
columns.push(Column::GitStatus);
|
|
|
}
|
|
|
|
|
|
+ if self.subdir_git_repos {
|
|
|
+ columns.push(Column::SubdirGitRepoStatus);
|
|
|
+ }
|
|
|
+
|
|
|
+ if self.subdir_git_repos_no_stat {
|
|
|
+ columns.push(Column::SubdirGitRepoNoStatus);
|
|
|
+ }
|
|
|
+
|
|
|
columns
|
|
|
}
|
|
|
}
|
|
|
@@ -135,6 +145,8 @@ pub enum Column {
|
|
|
#[cfg(unix)]
|
|
|
Inode,
|
|
|
GitStatus,
|
|
|
+ SubdirGitRepoStatus,
|
|
|
+ SubdirGitRepoNoStatus,
|
|
|
#[cfg(unix)]
|
|
|
Octal,
|
|
|
}
|
|
|
@@ -192,6 +204,8 @@ impl Column {
|
|
|
#[cfg(unix)]
|
|
|
Self::Inode => "inode",
|
|
|
Self::GitStatus => "Git",
|
|
|
+ Self::SubdirGitRepoStatus => "Repo",
|
|
|
+ Self::SubdirGitRepoNoStatus => "Repo",
|
|
|
#[cfg(unix)]
|
|
|
Self::Octal => "Octal",
|
|
|
}
|
|
|
@@ -496,6 +510,12 @@ impl<'a, 'f> Table<'a> {
|
|
|
Column::GitStatus => {
|
|
|
self.git_status(file).render(self.theme)
|
|
|
}
|
|
|
+ Column::SubdirGitRepoStatus => {
|
|
|
+ self.subdir_git_repo(file, true).render()
|
|
|
+ }
|
|
|
+ Column::SubdirGitRepoNoStatus => {
|
|
|
+ self.subdir_git_repo(file, false).render()
|
|
|
+ }
|
|
|
#[cfg(unix)]
|
|
|
Column::Octal => {
|
|
|
self.octal_permissions(file).render(self.theme.ui.octal)
|
|
|
@@ -524,6 +544,15 @@ impl<'a, 'f> Table<'a> {
|
|
|
.unwrap_or_default()
|
|
|
}
|
|
|
|
|
|
+ fn subdir_git_repo(&self, file: &File<'_>, status : bool) -> f::SubdirGitRepo {
|
|
|
+ debug!("Getting subdir repo status for path {:?}", file.path);
|
|
|
+
|
|
|
+ if file.is_directory(){
|
|
|
+ return f::SubdirGitRepo::from_path(&file.path, status);
|
|
|
+ }
|
|
|
+ f::SubdirGitRepo::default()
|
|
|
+ }
|
|
|
+
|
|
|
pub fn render(&self, row: Row) -> TextCell {
|
|
|
let mut cell = TextCell::default();
|
|
|
|