mirror of
https://github.com/Llewellynvdm/exa.git
synced 2024-11-05 04:17:51 +00:00
Inode is probably the easiest one
This commit is contained in:
parent
094e660003
commit
4a5cb5361d
31
src/output/render/inode.rs
Normal file
31
src/output/render/inode.rs
Normal file
@ -0,0 +1,31 @@
|
||||
use output::cell::TextCell;
|
||||
use output::colours::Colours;
|
||||
use fs::fields as f;
|
||||
|
||||
|
||||
impl f::Inode {
|
||||
pub fn render(&self, colours: &Colours) -> TextCell {
|
||||
TextCell::paint(colours.inode, self.0.to_string())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#[cfg(test)]
|
||||
pub mod test {
|
||||
use output::details::Details;
|
||||
use output::cell::TextCell;
|
||||
use fs::fields as f;
|
||||
|
||||
use ansi_term::Colour::*;
|
||||
|
||||
|
||||
#[test]
|
||||
fn blocklessness() {
|
||||
let mut details = Details::default();
|
||||
details.colours.inode = Cyan.underline();
|
||||
|
||||
let io = f::Inode(1414213);
|
||||
let expected = TextCell::paint_str(Cyan.underline(), "1414213");
|
||||
assert_eq!(expected, io.render(&details.colours).into());
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
mod blocks;
|
||||
mod git;
|
||||
mod groups;
|
||||
mod inode;
|
||||
mod links;
|
||||
mod permissions;
|
||||
mod size;
|
||||
@ -15,12 +16,6 @@ use datetime::fmt::DateFormat;
|
||||
use locale;
|
||||
|
||||
|
||||
impl f::Inode {
|
||||
pub fn render(&self, colours: &Colours) -> TextCell {
|
||||
TextCell::paint(colours.inode, self.0.to_string())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#[allow(trivial_numeric_casts)]
|
||||
impl f::Time {
|
||||
|
Loading…
Reference in New Issue
Block a user