diff options
author | Benjamin Sago <ogham@bsago.me> | 2015-12-22 13:14:32 +1100 |
---|---|---|
committer | Benjamin Sago <ogham@bsago.me> | 2015-12-22 13:14:32 +1100 |
commit | d1ea4c0ff546550acb96a73b7bfa5d7c2968450e (patch) | |
tree | e34d047d47ccf1c94ba7b20bb7e69d94f6c3bca0 /src | |
parent | fb22c7456de50a2dcd5c2c4b975ba5ce670cc042 (diff) |
Move TreePart to its own module
Diffstat (limited to 'src')
-rw-r--r-- | src/output/details.rs | 29 | ||||
-rw-r--r-- | src/output/mod.rs | 1 | ||||
-rw-r--r-- | src/output/tree.rs | 26 |
3 files changed, 28 insertions, 28 deletions
diff --git a/src/output/details.rs b/src/output/details.rs index a31816e..5c3231b 100644 --- a/src/output/details.rs +++ b/src/output/details.rs @@ -137,6 +137,7 @@ use options::{FileFilter, RecurseOptions}; use output::colours::Colours; use output::column::{Alignment, Column, Columns, SizeFormat}; use output::cell::{TextCell, DisplayWidth}; +use output::tree::TreePart; use super::filename; @@ -744,34 +745,6 @@ impl<U> Table<U> where U: Users { } -#[derive(PartialEq, Debug, Clone)] -enum TreePart { - - /// Rightmost column, *not* the last in the directory. - Edge, - - /// Not the rightmost column, and the directory has not finished yet. - Line, - - /// Rightmost column, and the last in the directory. - Corner, - - /// Not the rightmost column, and the directory *has* finished. - Blank, -} - -impl TreePart { - fn ascii_art(&self) -> &'static str { - match *self { - TreePart::Edge => "├──", - TreePart::Line => "│ ", - TreePart::Corner => "└──", - TreePart::Blank => " ", - } - } -} - - lazy_static! { static ref DATE_AND_TIME: DateFormat<'static> = DateFormat::parse("{2>:D} {:M} {2>:h}:{02>:m}").unwrap(); diff --git a/src/output/mod.rs b/src/output/mod.rs index f095a79..b5bc422 100644 --- a/src/output/mod.rs +++ b/src/output/mod.rs @@ -16,6 +16,7 @@ mod grid_details; pub mod column; mod cell; mod colours; +mod tree; pub fn filename(file: File, colours: &Colours, links: bool) -> TextCellContents { if links && file.is_link() { diff --git a/src/output/tree.rs b/src/output/tree.rs new file mode 100644 index 0000000..be3f550 --- /dev/null +++ b/src/output/tree.rs @@ -0,0 +1,26 @@ +#[derive(PartialEq, Debug, Clone)] +pub enum TreePart { + + /// Rightmost column, *not* the last in the directory. + Edge, + + /// Not the rightmost column, and the directory has not finished yet. + Line, + + /// Rightmost column, and the last in the directory. + Corner, + + /// Not the rightmost column, and the directory *has* finished. + Blank, +} + +impl TreePart { + pub fn ascii_art(&self) -> &'static str { + match *self { + TreePart::Edge => "├──", + TreePart::Line => "│ ", + TreePart::Corner => "└──", + TreePart::Blank => " ", + } + } +} |