mirror of
https://github.com/Llewellynvdm/exa.git
synced 2024-12-27 02:12:53 +00:00
Allow xattrs to be shown in --tree without --long
This restriction was originally only there because a standalone --tree wasn’t a thing. Now it’s there, there’s no reason to forbid the combination.
This commit is contained in:
parent
b5bcf22612
commit
89540edb22
@ -159,7 +159,6 @@ mod test {
|
|||||||
use super::{Options, Misfire, flags};
|
use super::{Options, Misfire, flags};
|
||||||
use std::ffi::OsString;
|
use std::ffi::OsString;
|
||||||
use fs::filter::{SortField, SortCase};
|
use fs::filter::{SortField, SortCase};
|
||||||
use fs::feature::xattr;
|
|
||||||
|
|
||||||
/// Creates an `OSStr` (used in tests)
|
/// Creates an `OSStr` (used in tests)
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
@ -274,13 +273,4 @@ mod test {
|
|||||||
let opts = Options::getopts(&args);
|
let opts = Options::getopts(&args);
|
||||||
assert_eq!(opts.unwrap_err(), Misfire::Useless(&flags::GIT, false, &flags::LONG))
|
assert_eq!(opts.unwrap_err(), Misfire::Useless(&flags::GIT, false, &flags::LONG))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn extended_without_long() {
|
|
||||||
if xattr::ENABLED {
|
|
||||||
let args = [ os("--extended") ];
|
|
||||||
let opts = Options::getopts(&args);
|
|
||||||
assert_eq!(opts.unwrap_err(), Misfire::Useless(&flags::EXTENDED, false, &flags::LONG))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -61,9 +61,6 @@ impl Mode {
|
|||||||
else if matches.has(&flags::LEVEL) && !matches.has(&flags::RECURSE) && !matches.has(&flags::TREE) {
|
else if matches.has(&flags::LEVEL) && !matches.has(&flags::RECURSE) && !matches.has(&flags::TREE) {
|
||||||
Err(Useless2(&flags::LEVEL, &flags::RECURSE, &flags::TREE))
|
Err(Useless2(&flags::LEVEL, &flags::RECURSE, &flags::TREE))
|
||||||
}
|
}
|
||||||
else if xattr::ENABLED && matches.has(&flags::EXTENDED) {
|
|
||||||
Err(Useless(&flags::EXTENDED, false, &flags::LONG))
|
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@ -83,7 +80,7 @@ impl Mode {
|
|||||||
let details = details::Options {
|
let details = details::Options {
|
||||||
table: None,
|
table: None,
|
||||||
header: false,
|
header: false,
|
||||||
xattr: false,
|
xattr: xattr::ENABLED && matches.has(&flags::EXTENDED),
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(Mode::Details(details))
|
Ok(Mode::Details(details))
|
||||||
@ -106,7 +103,7 @@ impl Mode {
|
|||||||
let details = details::Options {
|
let details = details::Options {
|
||||||
table: None,
|
table: None,
|
||||||
header: false,
|
header: false,
|
||||||
xattr: false,
|
xattr: xattr::ENABLED && matches.has(&flags::EXTENDED),
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(Mode::Details(details))
|
Ok(Mode::Details(details))
|
||||||
|
57
xtests/attributes_dir
Normal file
57
xtests/attributes_dir
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
[36m/testcases/[1;34mattributes[0m
|
||||||
|
[38;5;244m├──[0m [1;34mdirs[0m
|
||||||
|
[38;5;244m│ ├──[0m [1;34mno-xattrs_empty[0m
|
||||||
|
[38;5;244m│ ├──[0m [1;34mno-xattrs_empty_forbidden[0m
|
||||||
|
[38;5;244m│ │ └──[0m [31m<Permission denied (os error 13)>[0m
|
||||||
|
[38;5;244m│ ├──[0m [1;34mno-xattrs_one-file[0m
|
||||||
|
[38;5;244m│ │ └──[0m file-in-question
|
||||||
|
[38;5;244m│ ├──[0m [1;34mno-xattrs_one-file_forbidden[0m
|
||||||
|
[38;5;244m│ │ └──[0m [31m<Permission denied (os error 13)>[0m
|
||||||
|
[38;5;244m│ ├──[0m [1;34mno-xattrs_two-files[0m
|
||||||
|
[38;5;244m│ │ ├──[0m that-file
|
||||||
|
[38;5;244m│ │ └──[0m this-file
|
||||||
|
[38;5;244m│ ├──[0m [1;34mno-xattrs_two-files_forbidden[0m
|
||||||
|
[38;5;244m│ │ └──[0m [31m<Permission denied (os error 13)>[0m
|
||||||
|
[38;5;244m│ ├──[0m [1;34mone-xattr_empty[0m
|
||||||
|
[38;5;244m│ │ └──[0m user.greeting (len 5)
|
||||||
|
[38;5;244m│ ├──[0m [1;34mone-xattr_empty_forbidden[0m
|
||||||
|
[38;5;244m│ │ └──[0m [31m<Permission denied (os error 13)>[0m
|
||||||
|
[38;5;244m│ ├──[0m [1;34mone-xattr_one-file[0m
|
||||||
|
[38;5;244m│ │ ├──[0m user.greeting (len 5)
|
||||||
|
[38;5;244m│ │ └──[0m file-in-question
|
||||||
|
[38;5;244m│ ├──[0m [1;34mone-xattr_one-file_forbidden[0m
|
||||||
|
[38;5;244m│ │ └──[0m [31m<Permission denied (os error 13)>[0m
|
||||||
|
[38;5;244m│ ├──[0m [1;34mone-xattr_two-files[0m
|
||||||
|
[38;5;244m│ │ ├──[0m user.greeting (len 5)
|
||||||
|
[38;5;244m│ │ ├──[0m that-file
|
||||||
|
[38;5;244m│ │ └──[0m this-file
|
||||||
|
[38;5;244m│ ├──[0m [1;34mone-xattr_two-files_forbidden[0m
|
||||||
|
[38;5;244m│ │ └──[0m [31m<Permission denied (os error 13)>[0m
|
||||||
|
[38;5;244m│ ├──[0m [1;34mtwo-xattrs_empty[0m
|
||||||
|
[38;5;244m│ │ ├──[0m user.greeting (len 5)
|
||||||
|
[38;5;244m│ │ └──[0m user.another_greeting (len 2)
|
||||||
|
[38;5;244m│ ├──[0m [1;34mtwo-xattrs_empty_forbidden[0m
|
||||||
|
[38;5;244m│ │ └──[0m [31m<Permission denied (os error 13)>[0m
|
||||||
|
[38;5;244m│ ├──[0m [1;34mtwo-xattrs_one-file[0m
|
||||||
|
[38;5;244m│ │ ├──[0m user.greeting (len 5)
|
||||||
|
[38;5;244m│ │ ├──[0m user.another_greeting (len 2)
|
||||||
|
[38;5;244m│ │ └──[0m file-in-question
|
||||||
|
[38;5;244m│ ├──[0m [1;34mtwo-xattrs_one-file_forbidden[0m
|
||||||
|
[38;5;244m│ │ └──[0m [31m<Permission denied (os error 13)>[0m
|
||||||
|
[38;5;244m│ ├──[0m [1;34mtwo-xattrs_two-files[0m
|
||||||
|
[38;5;244m│ │ ├──[0m user.greeting (len 5)
|
||||||
|
[38;5;244m│ │ ├──[0m user.another_greeting (len 2)
|
||||||
|
[38;5;244m│ │ ├──[0m that-file
|
||||||
|
[38;5;244m│ │ └──[0m this-file
|
||||||
|
[38;5;244m│ └──[0m [1;34mtwo-xattrs_two-files_forbidden[0m
|
||||||
|
[38;5;244m│ └──[0m [31m<Permission denied (os error 13)>[0m
|
||||||
|
[38;5;244m└──[0m [1;34mfiles[0m
|
||||||
|
[38;5;244m ├──[0m no-xattrs
|
||||||
|
[38;5;244m ├──[0m no-xattrs_forbidden
|
||||||
|
[38;5;244m ├──[0m one-xattr
|
||||||
|
[38;5;244m │ └──[0m user.greeting (len 5)
|
||||||
|
[38;5;244m ├──[0m one-xattr_forbidden
|
||||||
|
[38;5;244m ├──[0m two-xattrs
|
||||||
|
[38;5;244m │ ├──[0m user.greeting (len 5)
|
||||||
|
[38;5;244m │ └──[0m user.another_greeting (len 2)
|
||||||
|
[38;5;244m └──[0m two-xattrs_forbidden
|
56
xtests/attributes_files
Normal file
56
xtests/attributes_files
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
[36m/testcases/attributes/[1;34mdirs[0m
|
||||||
|
[38;5;244m├──[0m [1;34mno-xattrs_empty[0m
|
||||||
|
[38;5;244m├──[0m [1;34mno-xattrs_empty_forbidden[0m
|
||||||
|
[38;5;244m│ └──[0m [31m<Permission denied (os error 13)>[0m
|
||||||
|
[38;5;244m├──[0m [1;34mno-xattrs_one-file[0m
|
||||||
|
[38;5;244m│ └──[0m file-in-question
|
||||||
|
[38;5;244m├──[0m [1;34mno-xattrs_one-file_forbidden[0m
|
||||||
|
[38;5;244m│ └──[0m [31m<Permission denied (os error 13)>[0m
|
||||||
|
[38;5;244m├──[0m [1;34mno-xattrs_two-files[0m
|
||||||
|
[38;5;244m│ ├──[0m that-file
|
||||||
|
[38;5;244m│ └──[0m this-file
|
||||||
|
[38;5;244m├──[0m [1;34mno-xattrs_two-files_forbidden[0m
|
||||||
|
[38;5;244m│ └──[0m [31m<Permission denied (os error 13)>[0m
|
||||||
|
[38;5;244m├──[0m [1;34mone-xattr_empty[0m
|
||||||
|
[38;5;244m│ └──[0m user.greeting (len 5)
|
||||||
|
[38;5;244m├──[0m [1;34mone-xattr_empty_forbidden[0m
|
||||||
|
[38;5;244m│ └──[0m [31m<Permission denied (os error 13)>[0m
|
||||||
|
[38;5;244m├──[0m [1;34mone-xattr_one-file[0m
|
||||||
|
[38;5;244m│ ├──[0m user.greeting (len 5)
|
||||||
|
[38;5;244m│ └──[0m file-in-question
|
||||||
|
[38;5;244m├──[0m [1;34mone-xattr_one-file_forbidden[0m
|
||||||
|
[38;5;244m│ └──[0m [31m<Permission denied (os error 13)>[0m
|
||||||
|
[38;5;244m├──[0m [1;34mone-xattr_two-files[0m
|
||||||
|
[38;5;244m│ ├──[0m user.greeting (len 5)
|
||||||
|
[38;5;244m│ ├──[0m that-file
|
||||||
|
[38;5;244m│ └──[0m this-file
|
||||||
|
[38;5;244m├──[0m [1;34mone-xattr_two-files_forbidden[0m
|
||||||
|
[38;5;244m│ └──[0m [31m<Permission denied (os error 13)>[0m
|
||||||
|
[38;5;244m├──[0m [1;34mtwo-xattrs_empty[0m
|
||||||
|
[38;5;244m│ ├──[0m user.greeting (len 5)
|
||||||
|
[38;5;244m│ └──[0m user.another_greeting (len 2)
|
||||||
|
[38;5;244m├──[0m [1;34mtwo-xattrs_empty_forbidden[0m
|
||||||
|
[38;5;244m│ └──[0m [31m<Permission denied (os error 13)>[0m
|
||||||
|
[38;5;244m├──[0m [1;34mtwo-xattrs_one-file[0m
|
||||||
|
[38;5;244m│ ├──[0m user.greeting (len 5)
|
||||||
|
[38;5;244m│ ├──[0m user.another_greeting (len 2)
|
||||||
|
[38;5;244m│ └──[0m file-in-question
|
||||||
|
[38;5;244m├──[0m [1;34mtwo-xattrs_one-file_forbidden[0m
|
||||||
|
[38;5;244m│ └──[0m [31m<Permission denied (os error 13)>[0m
|
||||||
|
[38;5;244m├──[0m [1;34mtwo-xattrs_two-files[0m
|
||||||
|
[38;5;244m│ ├──[0m user.greeting (len 5)
|
||||||
|
[38;5;244m│ ├──[0m user.another_greeting (len 2)
|
||||||
|
[38;5;244m│ ├──[0m that-file
|
||||||
|
[38;5;244m│ └──[0m this-file
|
||||||
|
[38;5;244m└──[0m [1;34mtwo-xattrs_two-files_forbidden[0m
|
||||||
|
[38;5;244m └──[0m [31m<Permission denied (os error 13)>[0m
|
||||||
|
[36m/testcases/attributes/[1;34mfiles[0m
|
||||||
|
[38;5;244m├──[0m no-xattrs
|
||||||
|
[38;5;244m├──[0m no-xattrs_forbidden
|
||||||
|
[38;5;244m├──[0m one-xattr
|
||||||
|
[38;5;244m│ └──[0m user.greeting (len 5)
|
||||||
|
[38;5;244m├──[0m one-xattr_forbidden
|
||||||
|
[38;5;244m├──[0m two-xattrs
|
||||||
|
[38;5;244m│ ├──[0m user.greeting (len 5)
|
||||||
|
[38;5;244m│ └──[0m user.another_greeting (len 2)
|
||||||
|
[38;5;244m└──[0m two-xattrs_forbidden
|
@ -57,8 +57,10 @@ COLUMNS=200 $exa $testcases/files/* -lG | diff -q - $results/files_star_lG_200
|
|||||||
|
|
||||||
|
|
||||||
# Attributes
|
# Attributes
|
||||||
# (there are many tests, but they're all done in one go)
|
# (there are many tests, but they’re all done in one go)
|
||||||
$exa $testcases/attributes -l@T | diff -q - $results/attributes || exit 1
|
$exa $testcases/attributes -l@T | diff -q - $results/attributes || exit 1
|
||||||
|
$exa $testcases/attributes -@T | diff -q - $results/attributes_dir || exit 1
|
||||||
|
$exa $testcases/attributes/* -@T | diff -q - $results/attributes_files || exit 1
|
||||||
|
|
||||||
|
|
||||||
# UIDs and GIDs
|
# UIDs and GIDs
|
||||||
|
Loading…
Reference in New Issue
Block a user