mirror of
https://github.com/lsd-rs/lsd
synced 2024-12-14 06:02:36 +00:00
Run cargo fmt
This commit is contained in:
parent
917498022e
commit
78f13841e8
5 changed files with 39 additions and 16 deletions
18
src/app.rs
18
src/app.rs
|
@ -10,7 +10,8 @@ pub fn build_app() -> App<'static, 'static> {
|
|||
.short("a")
|
||||
.long("all")
|
||||
.help("Do not ignore entries starting with ."),
|
||||
).arg(
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("color")
|
||||
.long("color")
|
||||
.possible_value("always")
|
||||
|
@ -18,27 +19,32 @@ pub fn build_app() -> App<'static, 'static> {
|
|||
.possible_value("never")
|
||||
.default_value("auto")
|
||||
.help("When to use terminal colours"),
|
||||
).arg(
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("indicators")
|
||||
.short("F")
|
||||
.long("classify")
|
||||
.help("Append indicator (one of */=>@|) at the end of the file names"),
|
||||
).arg(
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("long")
|
||||
.short("l")
|
||||
.long("long")
|
||||
.help("Display extended file metadata as a table"),
|
||||
).arg(
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("oneline")
|
||||
.short("1")
|
||||
.long("oneline")
|
||||
.help("Display one entry per line"),
|
||||
).arg(
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("recursive")
|
||||
.short("R")
|
||||
.long("recursive")
|
||||
.help("Recurse into directories"),
|
||||
).arg(
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("tree")
|
||||
.long("tree")
|
||||
.help("Recurse into directories and present the result as a tree"),
|
||||
|
|
|
@ -91,7 +91,8 @@ impl Core {
|
|||
} else {
|
||||
None
|
||||
}
|
||||
}).collect();
|
||||
})
|
||||
.collect();
|
||||
|
||||
self.run_inner(folder_dirs, depth);
|
||||
} else {
|
||||
|
|
|
@ -91,7 +91,8 @@ impl Display {
|
|||
.skip_while(|x| {
|
||||
code_size += 1;
|
||||
char::is_numeric(*x)
|
||||
}).count();
|
||||
})
|
||||
.count();
|
||||
nb_invisible_char += 6 + code_size; /* "[38;5;" + color number + "m" */
|
||||
}
|
||||
|
||||
|
|
|
@ -119,7 +119,8 @@ mod test {
|
|||
.strftime("%Y%m%d%H%M.%S")
|
||||
.unwrap()
|
||||
.to_string(),
|
||||
).arg(&file_path)
|
||||
)
|
||||
.arg(&file_path)
|
||||
.status()
|
||||
.unwrap()
|
||||
.success();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use icon::Icons;
|
||||
use color::{ColoredString, Colors, Elem};
|
||||
use icon::Icons;
|
||||
use meta::filetype::FileType;
|
||||
use std::cmp::{Ordering, PartialOrd};
|
||||
use std::path::Path;
|
||||
|
@ -39,7 +39,9 @@ impl Name {
|
|||
|
||||
pub fn render(&self, colors: &Colors, icons: &Icons) -> ColoredString {
|
||||
let icon = icons.get(self);
|
||||
let mut content = String::with_capacity(icon.len() + ICON_SPACE.len() +self.name.len() + 3 /* spaces */);
|
||||
let mut content = String::with_capacity(
|
||||
icon.len() + ICON_SPACE.len() + self.name.len() + 3, /* spaces */
|
||||
);
|
||||
|
||||
content += icon;
|
||||
content += ICON_SPACE;
|
||||
|
@ -94,9 +96,9 @@ impl PartialEq for Name {
|
|||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::Name;
|
||||
use icon::Icons;
|
||||
use ansi_term::Colour;
|
||||
use color::{Colors, Theme};
|
||||
use icon::Icons;
|
||||
use meta::FileType;
|
||||
use meta::Permissions;
|
||||
use std::fs::{self, File};
|
||||
|
@ -119,7 +121,10 @@ mod test {
|
|||
let file_type = FileType::new(&meta, &Permissions::from(&meta));
|
||||
let name = Name::new(&file_path, file_type);
|
||||
|
||||
assert_eq!(Colour::Fixed(184).paint(" file.txt"), name.render(&colors, &icons));
|
||||
assert_eq!(
|
||||
Colour::Fixed(184).paint(" file.txt"),
|
||||
name.render(&colors, &icons)
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -136,7 +141,10 @@ mod test {
|
|||
let file_type = FileType::new(&meta, &Permissions::from(&meta));
|
||||
let name = Name::new(&dir_path, file_type);
|
||||
|
||||
assert_eq!(Colour::Fixed(33).paint(" directory"), name.render(&colors, &icons));
|
||||
assert_eq!(
|
||||
Colour::Fixed(33).paint(" directory"),
|
||||
name.render(&colors, &icons)
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -159,7 +167,10 @@ mod test {
|
|||
let file_type = FileType::new(&meta, &Permissions::from(&meta));
|
||||
let name = Name::new(&symlink_path, file_type);
|
||||
|
||||
assert_eq!(Colour::Fixed(44).paint(" target.tmp"), name.render(&colors, &icons));
|
||||
assert_eq!(
|
||||
Colour::Fixed(44).paint(" target.tmp"),
|
||||
name.render(&colors, &icons)
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -181,7 +192,10 @@ mod test {
|
|||
let file_type = FileType::new(&meta, &Permissions::from(&meta));
|
||||
let name = Name::new(&pipe_path, file_type);
|
||||
|
||||
assert_eq!(Colour::Fixed(184).paint(" pipe.tmp"), name.render(&colors, &icons));
|
||||
assert_eq!(
|
||||
Colour::Fixed(184).paint(" pipe.tmp"),
|
||||
name.render(&colors, &icons)
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Reference in a new issue