diff options
author | Ben S <ogham@bsago.me> | 2015-11-14 23:32:57 +0000 |
---|---|---|
committer | Ben S <ogham@bsago.me> | 2015-11-14 23:32:57 +0000 |
commit | 10468797bb70f3d16c28127661bb978e5259407c (patch) | |
tree | ba10356c6a3e6fd28bce8da9169e3ca42ea30ccc /src/output/details.rs | |
parent | cc04d0452ffa5583b512bfe38d6d680d181a84b2 (diff) |
Move many Options structs to the output module
This cleans up the options module, moving the structs that were *only* in use for the columns view out of it.
The new OptionSet trait is used to add the ‘deduce’ methods that used to be present on the values.
Diffstat (limited to 'src/output/details.rs')
-rw-r--r-- | src/output/details.rs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/output/details.rs b/src/output/details.rs index c2bbfc0..95886ad 100644 --- a/src/output/details.rs +++ b/src/output/details.rs @@ -119,12 +119,12 @@ use std::ops::Add; use std::iter::repeat; use colours::Colours; -use column::{Alignment, Column, Cell}; use dir::Dir; use feature::xattr::{Attribute, FileAttributes}; use file::fields as f; use file::File; -use options::{Columns, FileFilter, RecurseOptions, SizeFormat}; +use options::{FileFilter, RecurseOptions}; +use output::column::{Alignment, Column, Columns, Cell, SizeFormat}; use ansi_term::{ANSIString, ANSIStrings, Style}; @@ -153,7 +153,7 @@ use super::filename; /// /// Almost all the heavy lifting is done in a Table object, which handles the /// columns for each row. -#[derive(PartialEq, Debug, Copy, Clone, Default)] +#[derive(PartialEq, Debug, Copy, Clone)] pub struct Details { /// A Columns object that says which columns should be included in the @@ -658,7 +658,7 @@ impl<U> Table<U> where U: Users { .map(|n| self.rows.iter().map(|row| row.column_width(n)).max().unwrap_or(0)) .collect(); - let total_width: usize = self.columns.len() + column_widths.iter().fold(0,Add::add); + let total_width: usize = self.columns.len() + column_widths.iter().fold(0, Add::add); for row in self.rows.iter() { let mut cell = Cell::empty(); @@ -754,8 +754,7 @@ pub mod test { pub use super::Table; pub use file::File; pub use file::fields as f; - - pub use column::{Cell, Column}; + pub use output::column::{Cell, Column}; pub use users::{User, Group, uid_t, gid_t}; pub use users::mock::MockUsers; |