From d86fc4286be613aab5a0a8ca70682c005eb71fa1 Mon Sep 17 00:00:00 2001 From: Benjamin Sago Date: Sat, 26 Aug 2017 23:53:47 +0100 Subject: [PATCH] \t and \s+$ --- src/bin/main.rs | 8 ++-- src/fs/dir.rs | 2 +- src/fs/feature/git.rs | 6 +-- src/fs/file.rs | 2 +- src/options/filter.rs | 4 +- src/output/render/blocks.rs | 24 ++++++------ src/output/render/git.rs | 8 ++-- src/output/render/groups.rs | 16 ++++---- src/output/render/links.rs | 16 ++++---- src/output/render/permissions.rs | 64 ++++++++++++++++---------------- src/output/render/size.rs | 34 ++++++++--------- src/output/render/users.rs | 18 ++++----- 12 files changed, 101 insertions(+), 101 deletions(-) diff --git a/src/bin/main.rs b/src/bin/main.rs index 6770c0d..0119ee5 100644 --- a/src/bin/main.rs +++ b/src/bin/main.rs @@ -9,7 +9,7 @@ use std::process::exit; fn main() { configure_logger(); - + let args: Vec = args_os().skip(1).collect(); match Exa::new(args.iter(), &mut stdout()) { Ok(mut exa) => { @@ -46,12 +46,12 @@ fn main() { pub fn configure_logger() { extern crate env_logger; extern crate log; - + let present = match var_os("EXA_DEBUG") { Some(debug) => debug.len() > 0, None => false, }; - + let mut logs = env_logger::LogBuilder::new(); if present { logs.filter(None, log::LogLevelFilter::Debug); @@ -59,7 +59,7 @@ pub fn configure_logger() { else { logs.filter(None, log::LogLevelFilter::Off); } - + if let Err(e) = logs.init() { writeln!(stderr(), "Failed to initialise logger: {}", e).unwrap(); } diff --git a/src/fs/dir.rs b/src/fs/dir.rs index f1b6453..77345d9 100644 --- a/src/fs/dir.rs +++ b/src/fs/dir.rs @@ -38,7 +38,7 @@ impl Dir { /// ourselves after the files have been read. pub fn read_dir(path: PathBuf, git: bool) -> IOResult { info!("Reading directory {:?}", &path); - + let contents: Vec = try!(fs::read_dir(&path)? .map(|result| result.map(|entry| entry.path())) .collect()); diff --git a/src/fs/feature/git.rs b/src/fs/feature/git.rs index 878740c..0bfc24e 100644 --- a/src/fs/feature/git.rs +++ b/src/fs/feature/git.rs @@ -16,7 +16,7 @@ impl Git { /// the files' statuses if one is found. pub fn scan(path: &Path) -> Result { info!("Scanning for Git repository under {:?}", path); - + let repo = git2::Repository::discover(path)?; let workdir = match repo.workdir() { Some(w) => w, @@ -24,8 +24,8 @@ impl Git { }; let statuses = repo.statuses(None)?.iter() - .map(|e| (workdir.join(Path::new(e.path().unwrap())), e.status())) - .collect(); + .map(|e| (workdir.join(Path::new(e.path().unwrap())), e.status())) + .collect(); Ok(Git { statuses: statuses }) } diff --git a/src/fs/file.rs b/src/fs/file.rs index 40d1f04..c07f879 100644 --- a/src/fs/file.rs +++ b/src/fs/file.rs @@ -64,7 +64,7 @@ impl<'dir> File<'dir> { let parent_dir = parent_dir.into(); let name = filename.into().unwrap_or_else(|| File::filename(&path)); let ext = File::ext(&path); - + debug!("Statting file {:?}", &path); let metadata = fs::symlink_metadata(&path)?; diff --git a/src/options/filter.rs b/src/options/filter.rs index a50f7e2..bfe4da7 100644 --- a/src/options/filter.rs +++ b/src/options/filter.rs @@ -101,10 +101,10 @@ impl SortField { // smaller, because that’s usually what the user expects to happen. Users will // name their files with numbers expecting them to be treated like numbers, // rather than lists of numeric characters. -// +// // In the same way, users will name their files with letters expecting the // order of the letters to matter, rather than each letter’s character’s ASCII -// value. So exa breaks from tradition and ignores case while sorting: +// value. So exa breaks from tradition and ignores case while sorting: // “apps” first, then “Documents”. // // You can get the old behaviour back by sorting with `--sort=Name`. diff --git a/src/output/render/blocks.rs b/src/output/render/blocks.rs index bd57bfc..789e46d 100644 --- a/src/output/render/blocks.rs +++ b/src/output/render/blocks.rs @@ -15,27 +15,27 @@ impl f::Blocks { pub trait Colours { - fn block_count(&self) -> Style; - fn no_blocks(&self) -> Style; + fn block_count(&self) -> Style; + fn no_blocks(&self) -> Style; } #[cfg(test)] pub mod test { - use ansi_term::Style; - use ansi_term::Colour::*; - - use super::Colours; + use ansi_term::Style; + use ansi_term::Colour::*; + + use super::Colours; use output::cell::TextCell; use fs::fields as f; - struct TestColours; - - impl Colours for TestColours { - fn block_count(&self) -> Style { Red.blink() } - fn no_blocks(&self) -> Style { Green.italic() } - } + struct TestColours; + + impl Colours for TestColours { + fn block_count(&self) -> Style { Red.blink() } + fn no_blocks(&self) -> Style { Green.italic() } + } #[test] diff --git a/src/output/render/git.rs b/src/output/render/git.rs index f821da2..41dfbd2 100644 --- a/src/output/render/git.rs +++ b/src/output/render/git.rs @@ -43,14 +43,14 @@ pub trait Colours { #[cfg(test)] pub mod test { - use super::Colours; + use super::Colours; use output::cell::{TextCell, DisplayWidth}; use fs::fields as f; use ansi_term::Colour::*; use ansi_term::Style; - - + + struct TestColours; impl Colours for TestColours { @@ -60,7 +60,7 @@ pub mod test { fn deleted(&self) -> Style { Fixed(93).normal() } fn renamed(&self) -> Style { Fixed(94).normal() } fn type_change(&self) -> Style { Fixed(95).normal() } - } + } #[test] diff --git a/src/output/render/groups.rs b/src/output/render/groups.rs index cee9287..6504e88 100644 --- a/src/output/render/groups.rs +++ b/src/output/render/groups.rs @@ -30,15 +30,15 @@ impl f::Group { pub trait Colours { - fn yours(&self) -> Style; - fn not_yours(&self) -> Style; + fn yours(&self) -> Style; + fn not_yours(&self) -> Style; } #[cfg(test)] #[allow(unused_results)] pub mod test { - use super::Colours; + use super::Colours; use fs::fields as f; use output::cell::TextCell; @@ -47,13 +47,13 @@ pub mod test { use users::os::unix::GroupExt; use ansi_term::Colour::*; use ansi_term::Style; - - + + struct TestColours; - + impl Colours for TestColours { - fn yours(&self) -> Style { Fixed(80).normal() } - fn not_yours(&self) -> Style { Fixed(81).normal() } + fn yours(&self) -> Style { Fixed(80).normal() } + fn not_yours(&self) -> Style { Fixed(81).normal() } } diff --git a/src/output/render/links.rs b/src/output/render/links.rs index 31c0e4f..0ad9b58 100644 --- a/src/output/render/links.rs +++ b/src/output/render/links.rs @@ -16,27 +16,27 @@ impl f::Links { pub trait Colours { - fn normal(&self) -> Style; - fn multi_link_file(&self) -> Style; + fn normal(&self) -> Style; + fn multi_link_file(&self) -> Style; } #[cfg(test)] pub mod test { - use super::Colours; + use super::Colours; use output::cell::{TextCell, DisplayWidth}; use fs::fields as f; use ansi_term::Colour::*; use ansi_term::Style; use locale; - - + + struct TestColours; - + impl Colours for TestColours { - fn normal(&self) -> Style { Blue.normal() } - fn multi_link_file(&self) -> Style { Blue.on(Red) } + fn normal(&self) -> Style { Blue.normal() } + fn multi_link_file(&self) -> Style { Blue.on(Red) } } diff --git a/src/output/render/permissions.rs b/src/output/render/permissions.rs index b58c42b..f4dd2b7 100644 --- a/src/output/render/permissions.rs +++ b/src/output/render/permissions.rs @@ -78,25 +78,25 @@ impl f::Permissions { pub trait Colours { - fn dash(&self) -> Style; - - fn user_read(&self) -> Style; - fn user_write(&self) -> Style; - fn user_execute_file(&self) -> Style; - fn user_execute_other(&self) -> Style; + fn dash(&self) -> Style; - fn group_read(&self) -> Style; - fn group_write(&self) -> Style; - fn group_execute(&self) -> Style; + fn user_read(&self) -> Style; + fn user_write(&self) -> Style; + fn user_execute_file(&self) -> Style; + fn user_execute_other(&self) -> Style; - fn other_read(&self) -> Style; - fn other_write(&self) -> Style; - fn other_execute(&self) -> Style; + fn group_read(&self) -> Style; + fn group_write(&self) -> Style; + fn group_execute(&self) -> Style; - fn special_user_file(&self) -> Style; - fn special_other(&self) -> Style; + fn other_read(&self) -> Style; + fn other_write(&self) -> Style; + fn other_execute(&self) -> Style; - fn attribute(&self) -> Style; + fn special_user_file(&self) -> Style; + fn special_other(&self) -> Style; + + fn attribute(&self) -> Style; } @@ -109,25 +109,25 @@ pub mod test { use ansi_term::Colour::*; use ansi_term::Style; - - + + struct TestColours; - + impl Colours for TestColours { - fn dash(&self) -> Style { Fixed(11).normal() } - fn user_read(&self) -> Style { Fixed(101).normal() } - fn user_write(&self) -> Style { Fixed(102).normal() } - fn user_execute_file(&self) -> Style { Fixed(103).normal() } - fn user_execute_other(&self) -> Style { Fixed(113).normal() } - fn group_read(&self) -> Style { Fixed(104).normal() } - fn group_write(&self) -> Style { Fixed(105).normal() } - fn group_execute(&self) -> Style { Fixed(106).normal() } - fn other_read(&self) -> Style { Fixed(107).normal() } - fn other_write(&self) -> Style { Fixed(108).normal() } - fn other_execute(&self) -> Style { Fixed(109).normal() } - fn special_user_file(&self) -> Style { Fixed(110).normal() } - fn special_other(&self) -> Style { Fixed(111).normal() } - fn attribute(&self) -> Style { Fixed(112).normal() } + fn dash(&self) -> Style { Fixed(11).normal() } + fn user_read(&self) -> Style { Fixed(101).normal() } + fn user_write(&self) -> Style { Fixed(102).normal() } + fn user_execute_file(&self) -> Style { Fixed(103).normal() } + fn user_execute_other(&self) -> Style { Fixed(113).normal() } + fn group_read(&self) -> Style { Fixed(104).normal() } + fn group_write(&self) -> Style { Fixed(105).normal() } + fn group_execute(&self) -> Style { Fixed(106).normal() } + fn other_read(&self) -> Style { Fixed(107).normal() } + fn other_write(&self) -> Style { Fixed(108).normal() } + fn other_execute(&self) -> Style { Fixed(109).normal() } + fn special_user_file(&self) -> Style { Fixed(110).normal() } + fn special_other(&self) -> Style { Fixed(111).normal() } + fn attribute(&self) -> Style { Fixed(112).normal() } } diff --git a/src/output/render/size.rs b/src/output/render/size.rs index 3cde354..ea80f98 100644 --- a/src/output/render/size.rs +++ b/src/output/render/size.rs @@ -69,19 +69,19 @@ impl f::DeviceIDs { pub trait Colours { - fn size(&self, size: u64) -> Style; - fn unit(&self) -> Style; - fn no_size(&self) -> Style; + fn size(&self, size: u64) -> Style; + fn unit(&self) -> Style; + fn no_size(&self) -> Style; - fn major(&self) -> Style; - fn comma(&self) -> Style; - fn minor(&self) -> Style; + fn major(&self) -> Style; + fn comma(&self) -> Style; + fn minor(&self) -> Style; } #[cfg(test)] pub mod test { - use super::Colours; + use super::Colours; use output::cell::{TextCell, DisplayWidth}; use output::table::SizeFormat; use fs::fields as f; @@ -89,18 +89,18 @@ pub mod test { use locale::Numeric as NumericLocale; use ansi_term::Colour::*; use ansi_term::Style; - - + + struct TestColours; - + impl Colours for TestColours { - fn size(&self, _size: u64) -> Style { Fixed(66).normal() } - fn unit(&self) -> Style { Fixed(77).bold() } - fn no_size(&self) -> Style { Black.italic() } - - fn major(&self) -> Style { Blue.on(Red) } - fn comma(&self) -> Style { Green.italic() } - fn minor(&self) -> Style { Cyan.on(Yellow) } + fn size(&self, _size: u64) -> Style { Fixed(66).normal() } + fn unit(&self) -> Style { Fixed(77).bold() } + fn no_size(&self) -> Style { Black.italic() } + + fn major(&self) -> Style { Blue.on(Red) } + fn comma(&self) -> Style { Green.italic() } + fn minor(&self) -> Style { Cyan.on(Yellow) } } diff --git a/src/output/render/users.rs b/src/output/render/users.rs index 34bbeef..75ff4c6 100644 --- a/src/output/render/users.rs +++ b/src/output/render/users.rs @@ -21,15 +21,15 @@ impl f::User { pub trait Colours { - fn you(&self) -> Style; - fn someone_else(&self) -> Style; + fn you(&self) -> Style; + fn someone_else(&self) -> Style; } #[cfg(test)] #[allow(unused_results)] pub mod test { - use super::Colours; + use super::Colours; use fs::fields as f; use output::cell::TextCell; @@ -37,15 +37,15 @@ pub mod test { use users::mock::MockUsers; use ansi_term::Colour::*; use ansi_term::Style; - - + + struct TestColours; - + impl Colours for TestColours { - fn you(&self) -> Style { Red.bold() } - fn someone_else(&self) -> Style { Blue.underline() } + fn you(&self) -> Style { Red.bold() } + fn someone_else(&self) -> Style { Blue.underline() } } - + #[test] fn named() {