Struct broot::display::GitStatusDisplay
source · pub struct GitStatusDisplay<'a, 's> {
pub width: usize,
/* private fields */
}
Fields§
§width: usize
Implementations§
source§impl<'a, 's> GitStatusDisplay<'a, 's>
impl<'a, 's> GitStatusDisplay<'a, 's>
sourcepub fn from(
status: &'a TreeGitStatus,
skin: &'s StyleMap,
available_width: usize
) -> Self
pub fn from(
status: &'a TreeGitStatus,
skin: &'s StyleMap,
available_width: usize
) -> Self
Examples found in repository?
src/display/displayable_tree.rs (lines 413-417)
394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434
pub fn write_root_line<'w, W: Write>(
&self,
cw: &mut CropWriter<'w, W>,
selected: bool,
) -> Result<(), ProgramError> {
cond_bg!(style, self, selected, self.skin.directory);
let line = &self.tree.lines[0];
if self.tree.options.show_sizes {
if let Some(s) = line.sum {
cw.queue_g_string(
style,
format!("{:>4} ", file_size::fit_4(s.to_size())),
)?;
}
}
let title = line.path.to_string_lossy();
cw.queue_str(style, &title)?;
if self.in_app && !cw.is_full() {
if let ComputationResult::Done(git_status) = &self.tree.git_status {
let git_status_display = GitStatusDisplay::from(
git_status,
self.skin,
cw.allowed,
);
git_status_display.write(cw, selected)?;
}
#[cfg(unix)]
if self.tree.options.show_root_fs {
if let Some(mount) = line.mount() {
let fs_space_display = crate::filesystems::MountSpaceDisplay::from(
&mount,
self.skin,
cw.allowed,
);
fs_space_display.write(cw, selected)?;
}
}
self.extend_line_bg(cw, selected)?;
}
Ok(())
}
sourcepub fn write<'w, W>(
&self,
cw: &mut CropWriter<'w, W>,
selected: bool
) -> Result<(), ProgramError>where
W: Write,
pub fn write<'w, W>(
&self,
cw: &mut CropWriter<'w, W>,
selected: bool
) -> Result<(), ProgramError>where
W: Write,
Examples found in repository?
src/display/displayable_tree.rs (line 418)
394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434
pub fn write_root_line<'w, W: Write>(
&self,
cw: &mut CropWriter<'w, W>,
selected: bool,
) -> Result<(), ProgramError> {
cond_bg!(style, self, selected, self.skin.directory);
let line = &self.tree.lines[0];
if self.tree.options.show_sizes {
if let Some(s) = line.sum {
cw.queue_g_string(
style,
format!("{:>4} ", file_size::fit_4(s.to_size())),
)?;
}
}
let title = line.path.to_string_lossy();
cw.queue_str(style, &title)?;
if self.in_app && !cw.is_full() {
if let ComputationResult::Done(git_status) = &self.tree.git_status {
let git_status_display = GitStatusDisplay::from(
git_status,
self.skin,
cw.allowed,
);
git_status_display.write(cw, selected)?;
}
#[cfg(unix)]
if self.tree.options.show_root_fs {
if let Some(mount) = line.mount() {
let fs_space_display = crate::filesystems::MountSpaceDisplay::from(
&mount,
self.skin,
cw.allowed,
);
fs_space_display.write(cw, selected)?;
}
}
self.extend_line_bg(cw, selected)?;
}
Ok(())
}