|
|
@@ -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,6 +279,9 @@ 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"))
|
|
|
}
|
|
|
@@ -490,6 +497,7 @@ pub struct Columns {
|
|
|
links: bool,
|
|
|
blocks: bool,
|
|
|
group: bool,
|
|
|
+ git: bool
|
|
|
}
|
|
|
|
|
|
impl Columns {
|
|
|
@@ -501,6 +509,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 +554,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);
|
|
|
}
|
|
|
}
|
|
|
@@ -647,6 +656,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() {
|