\t and \s+$

This commit is contained in:
Benjamin Sago 2017-08-26 23:53:47 +01:00
parent 075fe802b4
commit d86fc4286b
12 changed files with 101 additions and 101 deletions

View File

@ -9,7 +9,7 @@ use std::process::exit;
fn main() {
configure_logger();
let args: Vec<OsString> = 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();
}

View File

@ -38,7 +38,7 @@ impl Dir {
/// ourselves after the files have been read.
pub fn read_dir(path: PathBuf, git: bool) -> IOResult<Dir> {
info!("Reading directory {:?}", &path);
let contents: Vec<PathBuf> = try!(fs::read_dir(&path)?
.map(|result| result.map(|entry| entry.path()))
.collect());

View File

@ -16,7 +16,7 @@ impl Git {
/// the files' statuses if one is found.
pub fn scan(path: &Path) -> Result<Git, git2::Error> {
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 })
}

View File

@ -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)?;

View File

@ -101,10 +101,10 @@ impl SortField {
// smaller, because thats 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 letters characters 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`.

View File

@ -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]

View File

@ -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]

View File

@ -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() }
}

View File

@ -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) }
}

View File

@ -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() }
}

View File

@ -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) }
}

View File

@ -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() {