mirror of
https://github.com/Llewellynvdm/exa.git
synced 2024-11-26 05:47:32 +00:00
Don’t pass Dirs to the Table
A Table now doesn’t need to know about (or even import) Dir, because we can just not pass the Git reference in if it shouldn’t be using it.
This commit is contained in:
parent
f3c7fa500f
commit
558b13880b
@ -140,11 +140,12 @@ impl<'a> AsRef<File<'a>> for Egg<'a> {
|
||||
|
||||
|
||||
impl<'a> Render<'a> {
|
||||
pub fn render<W: Write>(self, git: Option<&'a GitCache>, w: &mut W) -> IOResult<()> {
|
||||
pub fn render<W: Write>(self, mut git: Option<&'a GitCache>, w: &mut W) -> IOResult<()> {
|
||||
let mut rows = Vec::new();
|
||||
|
||||
if let Some(ref table) = self.opts.table {
|
||||
let mut table = Table::new(&table, self.dir, git, &self.colours);
|
||||
if self.dir.is_none() { git = None }
|
||||
let mut table = Table::new(&table, git, &self.colours);
|
||||
|
||||
if self.opts.header {
|
||||
let header = table.header_row();
|
||||
|
@ -167,8 +167,9 @@ impl<'a> Render<'a> {
|
||||
None
|
||||
}
|
||||
|
||||
fn make_table<'t>(&'a self, options: &'a TableOptions, git: Option<&'a GitCache>, drender: &DetailsRender) -> (Table<'a>, Vec<DetailsRow>) {
|
||||
let mut table = Table::new(options, self.dir, git, self.colours);
|
||||
fn make_table<'t>(&'a self, options: &'a TableOptions, mut git: Option<&'a GitCache>, drender: &DetailsRender) -> (Table<'a>, Vec<DetailsRow>) {
|
||||
if self.dir.is_none() { git = None }
|
||||
let mut table = Table::new(options, git, self.colours);
|
||||
let mut rows = Vec::new();
|
||||
|
||||
if self.details.header {
|
||||
|
@ -13,7 +13,7 @@ use users::UsersCache;
|
||||
use style::Colours;
|
||||
use output::cell::TextCell;
|
||||
use output::time::TimeFormat;
|
||||
use fs::{File, Dir, fields as f};
|
||||
use fs::{File, fields as f};
|
||||
use fs::feature::git::GitCache;
|
||||
|
||||
|
||||
@ -284,9 +284,8 @@ pub struct Row {
|
||||
}
|
||||
|
||||
impl<'a, 'f> Table<'a> {
|
||||
pub fn new(options: &'a Options, dir: Option<&'a Dir>, git: Option<&'a GitCache>, colours: &'a Colours) -> Table<'a> {
|
||||
let has_git = if let (Some(g), Some(d)) = (git, dir) { g.has_anything_for(&d.path) } else { false };
|
||||
let columns = options.extra_columns.collect(has_git);
|
||||
pub fn new(options: &'a Options, git: Option<&'a GitCache>, colours: &'a Colours) -> Table<'a> {
|
||||
let columns = options.extra_columns.collect(git.is_some());
|
||||
let widths = TableWidths::zero(columns.len());
|
||||
|
||||
Table {
|
||||
|
Loading…
Reference in New Issue
Block a user