Reword ignore config option

This commit is contained in:
Kai Moschcau 2020-09-26 17:29:55 +02:00 committed by Abin Simon
parent 55a96a114d
commit 1bebe5b7c6
3 changed files with 30 additions and 30 deletions

View file

@ -68,9 +68,9 @@ pub fn build() -> App<'static, 'static> {
.help("Display extended file metadata as a table"), .help("Display extended file metadata as a table"),
) )
.arg( .arg(
Arg::with_name("no-config") Arg::with_name("ignore-config")
.long("no-config") .long("ignore-config")
.help("Do not read a configuration file"), .help("Ignore the configuration file"),
) )
.arg( .arg(
Arg::with_name("oneline") Arg::with_name("oneline")

View file

@ -99,7 +99,7 @@ fn main() {
.map(PathBuf::from) .map(PathBuf::from)
.collect(); .collect();
let config = if matches.is_present("no-config") { let config = if matches.is_present("ignore-config") {
Config::with_none() Config::with_none()
} else { } else {
Config::read_config() Config::read_config()

View file

@ -17,7 +17,7 @@ fn test_runs_okay() {
#[test] #[test]
fn test_list_empty_directory() { fn test_list_empty_directory() {
cmd() cmd()
.arg("--no-config") .arg("--ignore-config")
.arg(tempdir().path()) .arg(tempdir().path())
.assert() .assert()
.stdout(predicate::eq("")); .stdout(predicate::eq(""));
@ -28,14 +28,14 @@ fn test_list_almost_all_empty_directory() {
let matched = ""; let matched = "";
cmd() cmd()
.arg("--almost-all") .arg("--almost-all")
.arg("--no-config") .arg("--ignore-config")
.arg(tempdir().path()) .arg(tempdir().path())
.assert() .assert()
.stdout(predicate::eq(matched)); .stdout(predicate::eq(matched));
cmd() cmd()
.arg("-A") .arg("-A")
.arg("--no-config") .arg("--ignore-config")
.arg(tempdir().path()) .arg(tempdir().path())
.assert() .assert()
.stdout(predicate::eq(matched)); .stdout(predicate::eq(matched));
@ -46,14 +46,14 @@ fn test_list_all_empty_directory() {
let matched = "\\.\n\\.\\.\n$"; let matched = "\\.\n\\.\\.\n$";
cmd() cmd()
.arg("--all") .arg("--all")
.arg("--no-config") .arg("--ignore-config")
.arg(tempdir().path()) .arg(tempdir().path())
.assert() .assert()
.stdout(predicate::str::is_match(matched).unwrap()); .stdout(predicate::str::is_match(matched).unwrap());
cmd() cmd()
.arg("-a") .arg("-a")
.arg("--no-config") .arg("--ignore-config")
.arg(tempdir().path()) .arg(tempdir().path())
.assert() .assert()
.stdout(predicate::str::is_match(matched).unwrap()); .stdout(predicate::str::is_match(matched).unwrap());
@ -65,7 +65,7 @@ fn test_list_populated_directory() {
dir.child("one").touch().unwrap(); dir.child("one").touch().unwrap();
dir.child("two").touch().unwrap(); dir.child("two").touch().unwrap();
cmd() cmd()
.arg("--no-config") .arg("--ignore-config")
.arg(dir.path()) .arg(dir.path())
.assert() .assert()
.stdout(predicate::str::is_match("one\ntwo\n$").unwrap()); .stdout(predicate::str::is_match("one\ntwo\n$").unwrap());
@ -78,7 +78,7 @@ fn test_list_almost_all_populated_directory() {
dir.child("two").touch().unwrap(); dir.child("two").touch().unwrap();
cmd() cmd()
.arg("--almost-all") .arg("--almost-all")
.arg("--no-config") .arg("--ignore-config")
.arg(dir.path()) .arg(dir.path())
.assert() .assert()
.stdout(predicate::str::is_match("one\ntwo\n$").unwrap()); .stdout(predicate::str::is_match("one\ntwo\n$").unwrap());
@ -91,7 +91,7 @@ fn test_list_all_populated_directory() {
dir.child("two").touch().unwrap(); dir.child("two").touch().unwrap();
cmd() cmd()
.arg("--all") .arg("--all")
.arg("--no-config") .arg("--ignore-config")
.arg(dir.path()) .arg(dir.path())
.assert() .assert()
.stdout(predicate::str::is_match("\\.\n\\.\\.\none\ntwo\n$").unwrap()); .stdout(predicate::str::is_match("\\.\n\\.\\.\none\ntwo\n$").unwrap());
@ -110,13 +110,13 @@ fn test_list_inode_populated_directory() {
cmd() cmd()
.arg("--inode") .arg("--inode")
.arg("--no-config") .arg("--ignore-config")
.arg(dir.path()) .arg(dir.path())
.assert() .assert()
.stdout(predicate::str::is_match(matched).unwrap()); .stdout(predicate::str::is_match(matched).unwrap());
cmd() cmd()
.arg("-i") .arg("-i")
.arg("--no-config") .arg("--ignore-config")
.arg(dir.path()) .arg(dir.path())
.assert() .assert()
.stdout(predicate::str::is_match(matched).unwrap()); .stdout(predicate::str::is_match(matched).unwrap());
@ -136,7 +136,7 @@ fn test_list_block_inode_populated_directory_without_long() {
cmd() cmd()
.arg("--blocks") .arg("--blocks")
.arg("inode,name") .arg("inode,name")
.arg("--no-config") .arg("--ignore-config")
.arg(dir.path()) .arg(dir.path())
.assert() .assert()
.stdout(predicate::str::is_match(matched).unwrap()); .stdout(predicate::str::is_match(matched).unwrap());
@ -157,7 +157,7 @@ fn test_list_block_inode_populated_directory_with_long() {
.arg("--long") .arg("--long")
.arg("--blocks") .arg("--blocks")
.arg("inode,name") .arg("inode,name")
.arg("--no-config") .arg("--ignore-config")
.arg(dir.path()) .arg(dir.path())
.assert() .assert()
.stdout(predicate::str::is_match(matched).unwrap()); .stdout(predicate::str::is_match(matched).unwrap());
@ -169,7 +169,7 @@ fn test_list_inode_with_long_ok() {
cmd() cmd()
.arg("-i") .arg("-i")
.arg("-l") .arg("-l")
.arg("--no-config") .arg("--ignore-config")
.arg(dir.path()) .arg(dir.path())
.assert() .assert()
.success(); .success();
@ -185,13 +185,13 @@ fn test_list_broken_link_ok() {
cmd() cmd()
.arg(&broken_link) .arg(&broken_link)
.arg("--no-config") .arg("--ignore-config")
.assert() .assert()
.stderr(predicate::str::contains(matched).not()); .stderr(predicate::str::contains(matched).not());
cmd() cmd()
.arg("-l") .arg("-l")
.arg("--no-config") .arg("--ignore-config")
.arg(broken_link) .arg(broken_link)
.assert() .assert()
.stderr(predicate::str::contains(matched).not()); .stderr(predicate::str::contains(matched).not());
@ -207,13 +207,13 @@ fn test_nosymlink_on_non_long() {
cmd() cmd()
.arg("-l") .arg("-l")
.arg("--no-config") .arg("--ignore-config")
.arg(&link) .arg(&link)
.assert() .assert()
.stdout(predicate::str::contains(link_icon)); .stdout(predicate::str::contains(link_icon));
cmd() cmd()
.arg("--no-config") .arg("--ignore-config")
.arg(&link) .arg(&link)
.assert() .assert()
.stdout(predicate::str::contains(link_icon).not()); .stdout(predicate::str::contains(link_icon).not());
@ -232,7 +232,7 @@ fn test_dereference_link_right_type_and_no_link() {
cmd() cmd()
.arg("-l") .arg("-l")
.arg("--dereference") .arg("--dereference")
.arg("--no-config") .arg("--ignore-config")
.arg(&link) .arg(&link)
.assert() .assert()
.stdout(predicate::str::starts_with(file_type)) .stdout(predicate::str::starts_with(file_type))
@ -241,7 +241,7 @@ fn test_dereference_link_right_type_and_no_link() {
cmd() cmd()
.arg("-l") .arg("-l")
.arg("-L") .arg("-L")
.arg("--no-config") .arg("--ignore-config")
.arg(link) .arg(link)
.assert() .assert()
.stdout(predicate::str::starts_with(file_type)) .stdout(predicate::str::starts_with(file_type))
@ -257,7 +257,7 @@ fn test_show_folder_content_of_symlink() {
fs::symlink("target", &link).unwrap(); fs::symlink("target", &link).unwrap();
cmd() cmd()
.arg("--no-config") .arg("--ignore-config")
.arg(link) .arg(link)
.assert() .assert()
.stdout(predicate::str::starts_with("link").not()) .stdout(predicate::str::starts_with("link").not())
@ -274,7 +274,7 @@ fn test_no_show_folder_content_of_symlink_for_long() {
cmd() cmd()
.arg("-l") .arg("-l")
.arg("--no-config") .arg("--ignore-config")
.arg(link) .arg(link)
.assert() .assert()
.stdout(predicate::str::starts_with("lrw")) .stdout(predicate::str::starts_with("lrw"))
@ -282,7 +282,7 @@ fn test_no_show_folder_content_of_symlink_for_long() {
cmd() cmd()
.arg("-l") .arg("-l")
.arg("--no-config") .arg("--ignore-config")
.arg(dir.path().join("link/")) .arg(dir.path().join("link/"))
.assert() .assert()
.stdout(predicate::str::starts_with(".rw")) .stdout(predicate::str::starts_with(".rw"))
@ -299,7 +299,7 @@ fn test_show_folder_of_symlink_for_long_multi() {
cmd() cmd()
.arg("-l") .arg("-l")
.arg("--no-config") .arg("--ignore-config")
.arg(dir.path().join("link/")) .arg(dir.path().join("link/"))
.arg(dir.path().join("link")) .arg(dir.path().join("link"))
.assert() .assert()
@ -322,7 +322,7 @@ fn test_version_sort() {
dir.child("22").touch().unwrap(); dir.child("22").touch().unwrap();
cmd() cmd()
.arg("-v") .arg("-v")
.arg("--no-config") .arg("--ignore-config")
.arg(dir.path()) .arg(dir.path())
.assert() .assert()
.stdout( .stdout(
@ -338,7 +338,7 @@ fn test_version_sort_overwrite_by_timesort() {
cmd() cmd()
.arg("-v") .arg("-v")
.arg("-t") .arg("-t")
.arg("--no-config") .arg("--ignore-config")
.arg(dir.path()) .arg(dir.path())
.assert() .assert()
.stdout(predicate::str::is_match("11\n2\n$").unwrap()); .stdout(predicate::str::is_match("11\n2\n$").unwrap());
@ -356,7 +356,7 @@ fn test_version_sort_overwrite_by_sizesort() {
cmd() cmd()
.arg("-v") .arg("-v")
.arg("-S") .arg("-S")
.arg("--no-config") .arg("--ignore-config")
.arg(dir.path()) .arg(dir.path())
.assert() .assert()
.stdout(predicate::str::is_match("11\n2\n$").unwrap()); .stdout(predicate::str::is_match("11\n2\n$").unwrap());