Merge branch 'master' of github.com:ogham/exa

This commit is contained in:
Ben S 2015-03-11 15:09:50 +00:00
commit 7407cf1766
2 changed files with 27 additions and 1 deletions

View File

@ -16,6 +16,7 @@
- **-B**, **--bytes**: list file sizes in bytes, without prefixes
- **-d**, **--list-dirs**: list directories as regular files
- **-g**, **--group**: show group as well as user
- **--git**: show git status (depends on libgit2, see below)
- **-h**, **--header**: show a header row
- **-H**, **--links**: show number of hard links column
- **-i**, **--inode**: show inode number column

View File

@ -72,6 +72,10 @@ impl Options {
opts.optflag("", "version", "display version of exa");
opts.optflag("?", "help", "show list of command-line options");
if cfg!(feature="git") {
opts.optflag("", "git", "show git status");
}
if xattr::feature_implemented() {
opts.optflag("@", "extended", "display extended attribute keys and sizes in long (-l) output");
}
@ -275,12 +279,18 @@ impl View {
else if matches.opt_present("blocks") {
Err(Misfire::Useless("blocks", false, "long"))
}
else if cfg!(feature="git") && matches.opt_present("git") {
Err(Misfire::Useless("git", false, "long"))
}
else if matches.opt_present("time") {
Err(Misfire::Useless("time", false, "long"))
}
else if matches.opt_present("tree") {
Err(Misfire::Useless("tree", false, "long"))
}
else if matches.opt_present("group") {
Err(Misfire::Useless("group", false, "long"))
}
else if matches.opt_present("level") && !matches.opt_present("recurse") {
Err(Misfire::Useless2("level", "recurse", "tree"))
}
@ -490,6 +500,7 @@ pub struct Columns {
links: bool,
blocks: bool,
group: bool,
git: bool
}
impl Columns {
@ -501,6 +512,7 @@ impl Columns {
links: matches.opt_present("links"),
blocks: matches.opt_present("blocks"),
group: matches.opt_present("group"),
git: matches.opt_present("git"),
})
}
@ -545,7 +557,7 @@ impl Columns {
if cfg!(feature="git") {
if let Some(d) = dir {
if d.has_git_repo() {
if self.git && d.has_git_repo() {
columns.push(GitStatus);
}
}
@ -629,6 +641,12 @@ mod test {
assert_eq!(opts.unwrap_err(), Misfire::Useless("header", false, "long"))
}
#[test]
fn just_group() {
let opts = Options::getopts(&[ "--group".to_string() ]);
assert_eq!(opts.unwrap_err(), Misfire::Useless("group", false, "long"))
}
#[test]
fn just_inode() {
let opts = Options::getopts(&[ "--inode".to_string() ]);
@ -647,6 +665,13 @@ mod test {
assert_eq!(opts.unwrap_err(), Misfire::Useless("blocks", false, "long"))
}
#[test]
#[cfg(feature="git")]
fn just_git() {
let opts = Options::getopts(&[ "--git".to_string() ]);
assert_eq!(opts.unwrap_err(), Misfire::Useless("git", false, "long"))
}
#[test]
fn extended_without_long() {
if xattr::feature_implemented() {