From 5f2335829a846b964829579de7a424116a57e550 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Sat, 14 Aug 2021 17:21:18 +0200 Subject: [PATCH] refactor ~ revert to single quotes for "Try '{0 --help'" This is a test expectation for gnu. --- src/uu/basename/src/basename.rs | 4 ++-- src/uu/chroot/src/chroot.rs | 2 +- src/uu/cp/src/cp.rs | 2 +- src/uu/du/src/du.rs | 2 +- src/uu/ln/src/ln.rs | 2 +- src/uu/mknod/src/mknod.rs | 4 ++-- src/uu/mv/src/mv.rs | 2 +- src/uu/nice/src/nice.rs | 2 +- src/uu/pathchk/src/pathchk.rs | 2 +- src/uu/printf/src/printf.rs | 2 +- src/uu/readlink/src/readlink.rs | 2 +- src/uu/seq/src/seq.rs | 6 +++--- src/uu/stdbuf/src/stdbuf.rs | 2 +- src/uu/tr/src/tr.rs | 4 ++-- src/uu/unlink/src/unlink.rs | 4 ++-- src/uucore/src/lib/macros.rs | 2 +- src/uucore_procs/src/lib.rs | 2 +- tests/by-util/test_basename.rs | 4 ++-- tests/by-util/test_cp.rs | 2 +- tests/by-util/test_more.rs | 2 +- tests/by-util/test_mv.rs | 2 +- tests/by-util/test_nice.rs | 2 +- tests/by-util/test_seq.rs | 4 ++-- tests/by-util/test_stdbuf.rs | 2 +- tests/by-util/test_unlink.rs | 2 +- 25 files changed, 33 insertions(+), 33 deletions(-) diff --git a/src/uu/basename/src/basename.rs b/src/uu/basename/src/basename.rs index 8de55af80..d7aa52289 100644 --- a/src/uu/basename/src/basename.rs +++ b/src/uu/basename/src/basename.rs @@ -46,7 +46,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { if !matches.is_present(options::NAME) { crash!( 1, - "{1}\nTry `{0} --help` for more information.", + "{1}\nTry '{0} --help' for more information.", execution_phrase!(), "missing operand" ); @@ -60,7 +60,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { if !multiple_paths && matches.occurrences_of(options::NAME) > 2 { crash!( 1, - "extra operand '{1}'\nTry `{0} --help` for more information.", + "extra operand '{1}'\nTry '{0} --help' for more information.", execution_phrase!(), matches.values_of(options::NAME).unwrap().nth(2).unwrap() ); diff --git a/src/uu/chroot/src/chroot.rs b/src/uu/chroot/src/chroot.rs index b622b51a1..71a12b052 100644 --- a/src/uu/chroot/src/chroot.rs +++ b/src/uu/chroot/src/chroot.rs @@ -45,7 +45,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { Some(v) => Path::new(v), None => crash!( 1, - "Missing operand: NEWROOT\nTry `{} --help` for more information.", + "Missing operand: NEWROOT\nTry '{} --help' for more information.", execution_phrase!() ), }; diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index 086b734e8..a3b3db9a5 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -99,7 +99,7 @@ quick_error! { NotImplemented(opt: String) { display("Option '{}' not yet implemented.", opt) } /// Invalid arguments to backup - Backup(description: String) { display("{}\nTry `{} --help` for more information.", description, execution_phrase!()) } + Backup(description: String) { display("{}\nTry '{} --help' for more information.", description, execution_phrase!()) } } } diff --git a/src/uu/du/src/du.rs b/src/uu/du/src/du.rs index 629247f29..52750cb95 100644 --- a/src/uu/du/src/du.rs +++ b/src/uu/du/src/du.rs @@ -422,7 +422,7 @@ Valid arguments are: - 'full-iso' - 'long-iso' - 'iso' -Try `{} --help` for more information.", +Try '{} --help' for more information.", s, execution_phrase!() ), diff --git a/src/uu/ln/src/ln.rs b/src/uu/ln/src/ln.rs index 62748ae78..817aa91cb 100644 --- a/src/uu/ln/src/ln.rs +++ b/src/uu/ln/src/ln.rs @@ -68,7 +68,7 @@ impl Display for LnError { } Self::ExtraOperand(s) => write!( f, - "extra operand '{}'\nTry `{} --help` for more information.", + "extra operand '{}'\nTry '{} --help' for more information.", s, execution_phrase!() ), diff --git a/src/uu/mknod/src/mknod.rs b/src/uu/mknod/src/mknod.rs index 19c61bcfe..1a52de14f 100644 --- a/src/uu/mknod/src/mknod.rs +++ b/src/uu/mknod/src/mknod.rs @@ -113,7 +113,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { if ch == 'p' { if matches.is_present("major") || matches.is_present("minor") { eprintln!("Fifos do not have major and minor device numbers."); - eprintln!("Try `{} --help` for more information.", execution_phrase!()); + eprintln!("Try '{} --help' for more information.", execution_phrase!()); 1 } else { _mknod(file_name, S_IFIFO | mode, 0) @@ -122,7 +122,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { match (matches.value_of("major"), matches.value_of("minor")) { (None, None) | (_, None) | (None, _) => { eprintln!("Special files require major and minor device numbers."); - eprintln!("Try `{} --help` for more information.", execution_phrase!()); + eprintln!("Try '{} --help' for more information.", execution_phrase!()); 1 } (Some(major), Some(minor)) => { diff --git a/src/uu/mv/src/mv.rs b/src/uu/mv/src/mv.rs index ecd57ee5a..1cf45c36a 100644 --- a/src/uu/mv/src/mv.rs +++ b/src/uu/mv/src/mv.rs @@ -294,7 +294,7 @@ fn exec(files: &[PathBuf], b: Behavior) -> i32 { if b.no_target_dir { show_error!( "mv: extra operand '{}'\n\ - Try `{} --help` for more information.", + Try '{} --help' for more information.", files[2].display(), execution_phrase!() ); diff --git a/src/uu/nice/src/nice.rs b/src/uu/nice/src/nice.rs index 835034b74..a93137c10 100644 --- a/src/uu/nice/src/nice.rs +++ b/src/uu/nice/src/nice.rs @@ -53,7 +53,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { Some(nstr) => { if !matches.is_present(options::COMMAND) { show_error!( - "A command must be given with an adjustment.\nTry `{} --help` for more information.", + "A command must be given with an adjustment.\nTry '{} --help' for more information.", execution_phrase!() ); return 125; diff --git a/src/uu/pathchk/src/pathchk.rs b/src/uu/pathchk/src/pathchk.rs index 65c917ac0..c1ea76bf9 100644 --- a/src/uu/pathchk/src/pathchk.rs +++ b/src/uu/pathchk/src/pathchk.rs @@ -69,7 +69,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let paths = matches.values_of(options::PATH); let mut res = if paths.is_none() { show_error!( - "missing operand\nTry `{} --help` for more information", + "missing operand\nTry '{} --help' for more information", execution_phrase!() ); false diff --git a/src/uu/printf/src/printf.rs b/src/uu/printf/src/printf.rs index 26a1b29b2..22e02ffe2 100644 --- a/src/uu/printf/src/printf.rs +++ b/src/uu/printf/src/printf.rs @@ -283,7 +283,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { if args.len() <= 1 { println!( - "{0}: missing operand\nTry `{1} --help` for more information.", + "{0}: missing operand\nTry '{1} --help' for more information.", util_name!(), execution_phrase!() ); diff --git a/src/uu/readlink/src/readlink.rs b/src/uu/readlink/src/readlink.rs index cf788c1fe..81d8376f6 100644 --- a/src/uu/readlink/src/readlink.rs +++ b/src/uu/readlink/src/readlink.rs @@ -58,7 +58,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { if files.is_empty() { crash!( 1, - "missing operand\nTry `{} --help` for more information", + "missing operand\nTry '{} --help' for more information", execution_phrase!() ); } diff --git a/src/uu/seq/src/seq.rs b/src/uu/seq/src/seq.rs index f3e57881e..db5537b8b 100644 --- a/src/uu/seq/src/seq.rs +++ b/src/uu/seq/src/seq.rs @@ -70,13 +70,13 @@ impl FromStr for Number { Ok(n) => Ok(Number::BigInt(n)), Err(_) => match s.parse::() { Ok(value) if value.is_nan() => Err(format!( - "invalid 'not-a-number' argument: '{}'\nTry `{} --help` for more information.", + "invalid 'not-a-number' argument: '{}'\nTry '{} --help' for more information.", s, execution_phrase!(), )), Ok(value) => Ok(Number::F64(value)), Err(_) => Err(format!( - "invalid floating point argument: '{}'\nTry `{} --help` for more information.", + "invalid floating point argument: '{}'\nTry '{} --help' for more information.", s, execution_phrase!(), )), @@ -121,7 +121,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { }; if increment.is_zero() { show_error!( - "invalid Zero increment value: '{}'\nTry `{} --help` for more information.", + "invalid Zero increment value: '{}'\nTry '{} --help' for more information.", numbers[1], execution_phrase!() ); diff --git a/src/uu/stdbuf/src/stdbuf.rs b/src/uu/stdbuf/src/stdbuf.rs index 87e478b73..a16a40ce5 100644 --- a/src/uu/stdbuf/src/stdbuf.rs +++ b/src/uu/stdbuf/src/stdbuf.rs @@ -159,7 +159,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let options = ProgramOptions::try_from(&matches).unwrap_or_else(|e| { crash!( 125, - "{}\nTry `{} --help` for more information.", + "{}\nTry '{} --help' for more information.", e.0, execution_phrase!() ) diff --git a/src/uu/tr/src/tr.rs b/src/uu/tr/src/tr.rs index 0a277d663..7b6fbd6f2 100644 --- a/src/uu/tr/src/tr.rs +++ b/src/uu/tr/src/tr.rs @@ -263,7 +263,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { if sets.is_empty() { show_error!( - "missing operand\nTry `{} --help` for more information.", + "missing operand\nTry '{} --help' for more information.", execution_phrase!() ); return 1; @@ -271,7 +271,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { if !(delete_flag || squeeze_flag) && sets.len() < 2 { show_error!( - "missing operand after '{}'\nTry `{} --help` for more information.", + "missing operand after '{}'\nTry '{} --help' for more information.", sets[0], execution_phrase!() ); diff --git a/src/uu/unlink/src/unlink.rs b/src/uu/unlink/src/unlink.rs index 182729fd4..e0a743c1c 100644 --- a/src/uu/unlink/src/unlink.rs +++ b/src/uu/unlink/src/unlink.rs @@ -43,13 +43,13 @@ pub fn uumain(args: impl uucore::Args) -> i32 { if paths.is_empty() { crash!( 1, - "missing operand\nTry `{0} --help` for more information.", + "missing operand\nTry '{0} --help' for more information.", execution_phrase!() ); } else if paths.len() > 1 { crash!( 1, - "extra operand: '{1}'\nTry `{0} --help` for more information.", + "extra operand: '{1}'\nTry '{0} --help' for more information.", execution_phrase!(), paths[1] ); diff --git a/src/uucore/src/lib/macros.rs b/src/uucore/src/lib/macros.rs index 3d389d83d..c9fff455a 100644 --- a/src/uucore/src/lib/macros.rs +++ b/src/uucore/src/lib/macros.rs @@ -115,7 +115,7 @@ macro_rules! show_usage_error( ($($args:tt)+) => ({ eprint!("{}: ", $crate::util_name!()); eprintln!($($args)+); - eprintln!("Try `{} --help` for more information.", $crate::execution_phrase!()); + eprintln!("Try '{} --help' for more information.", $crate::execution_phrase!()); }) ); diff --git a/src/uucore_procs/src/lib.rs b/src/uucore_procs/src/lib.rs index 74ac60220..7f7460283 100644 --- a/src/uucore_procs/src/lib.rs +++ b/src/uucore_procs/src/lib.rs @@ -104,7 +104,7 @@ pub fn gen_uumain(_args: TokenStream, stream: TokenStream) -> TokenStream { show_error!("{}", s); } if e.usage() { - eprintln!("Try `{} --help` for more information.", execution_phrase!()); + eprintln!("Try '{} --help' for more information.", execution_phrase!()); } e.code() } diff --git a/tests/by-util/test_basename.rs b/tests/by-util/test_basename.rs index 9701e9973..02dfebeda 100644 --- a/tests/by-util/test_basename.rs +++ b/tests/by-util/test_basename.rs @@ -116,7 +116,7 @@ fn test_no_args() { fn test_no_args_output() { let ts = TestScenario::new(util_name!()); ts.ucmd().fails().stderr_is(&format!( - "{0}: missing operand\nTry `{1} {0} --help` for more information.", + "{0}: missing operand\nTry '{1} {0} --help' for more information.", ts.util_name, ts.bin_path.to_string_lossy() )); @@ -131,7 +131,7 @@ fn test_too_many_args() { fn test_too_many_args_output() { let ts = TestScenario::new(util_name!()); ts.ucmd().args(&["a", "b", "c"]).fails().stderr_is(format!( - "{0}: extra operand 'c'\nTry `{1} {0} --help` for more information.", + "{0}: extra operand 'c'\nTry '{1} {0} --help' for more information.", ts.util_name, ts.bin_path.to_string_lossy() )); diff --git a/tests/by-util/test_cp.rs b/tests/by-util/test_cp.rs index 6d739f448..b6b4c3311 100644 --- a/tests/by-util/test_cp.rs +++ b/tests/by-util/test_cp.rs @@ -568,7 +568,7 @@ fn test_cp_backup_no_clobber_conflicting_options() { .arg(TEST_HELLO_WORLD_SOURCE) .arg(TEST_HOW_ARE_YOU_SOURCE) .fails().stderr_is(&format!( - "{0}: options --backup and --no-clobber are mutually exclusive\nTry `{1} {0} --help` for more information.", + "{0}: options --backup and --no-clobber are mutually exclusive\nTry '{1} {0} --help' for more information.", ts.util_name, ts.bin_path.to_string_lossy() )); diff --git a/tests/by-util/test_more.rs b/tests/by-util/test_more.rs index a422b23a5..4b2719d8f 100644 --- a/tests/by-util/test_more.rs +++ b/tests/by-util/test_more.rs @@ -19,7 +19,7 @@ fn test_more_dir_arg() { let result = ts.ucmd().arg(".").run(); result.failure(); let expected_error_message = &format!( - "{0}: '.' is a directory.\nTry `{1} {0} --help` for more information.", + "{0}: '.' is a directory.\nTry '{1} {0} --help' for more information.", ts.util_name, ts.bin_path.to_string_lossy() ); diff --git a/tests/by-util/test_mv.rs b/tests/by-util/test_mv.rs index 8596f8477..8d9b00664 100644 --- a/tests/by-util/test_mv.rs +++ b/tests/by-util/test_mv.rs @@ -529,7 +529,7 @@ fn test_mv_backup_no_clobber_conflicting_options() { .arg("file1") .arg("file2") .fails() - .stderr_is(&format!("{0}: options --backup and --no-clobber are mutually exclusive\nTry `{1} {0} --help` for more information.", + .stderr_is(&format!("{0}: options --backup and --no-clobber are mutually exclusive\nTry '{1} {0} --help' for more information.", ts.util_name, ts.bin_path.to_string_lossy() )); diff --git a/tests/by-util/test_nice.rs b/tests/by-util/test_nice.rs index 639fa5697..7a99a333d 100644 --- a/tests/by-util/test_nice.rs +++ b/tests/by-util/test_nice.rs @@ -27,7 +27,7 @@ fn test_adjustment_with_no_command_should_error() { ts.ucmd() .args(&["-n", "19"]) .run() - .stderr_is(&format!("{0}: A command must be given with an adjustment.\nTry `{1} {0} --help` for more information.\n", + .stderr_is(&format!("{0}: A command must be given with an adjustment.\nTry '{1} {0} --help' for more information.\n", ts.util_name, ts.bin_path.to_string_lossy() )); diff --git a/tests/by-util/test_seq.rs b/tests/by-util/test_seq.rs index cc94d4b1f..eab7e16ce 100644 --- a/tests/by-util/test_seq.rs +++ b/tests/by-util/test_seq.rs @@ -5,7 +5,7 @@ fn test_rejects_nan() { let ts = TestScenario::new(util_name!()); ts.ucmd().args(&["NaN"]).fails().stderr_only(format!( - "{0}: invalid 'not-a-number' argument: 'NaN'\nTry `{1} {0} --help` for more information.", + "{0}: invalid 'not-a-number' argument: 'NaN'\nTry '{1} {0} --help' for more information.", ts.util_name, ts.bin_path.to_string_lossy() )); @@ -16,7 +16,7 @@ fn test_rejects_non_floats() { let ts = TestScenario::new(util_name!()); ts.ucmd().args(&["foo"]).fails().stderr_only(&format!( - "{0}: invalid floating point argument: 'foo'\nTry `{1} {0} --help` for more information.", + "{0}: invalid floating point argument: 'foo'\nTry '{1} {0} --help' for more information.", ts.util_name, ts.bin_path.to_string_lossy() )); diff --git a/tests/by-util/test_stdbuf.rs b/tests/by-util/test_stdbuf.rs index d705c0854..c05b65d70 100644 --- a/tests/by-util/test_stdbuf.rs +++ b/tests/by-util/test_stdbuf.rs @@ -59,7 +59,7 @@ fn test_stdbuf_line_buffering_stdin_fails() { .args(&["-i", "L", "head"]) .fails() .stderr_is(&format!( - "{0}: line buffering stdin is meaningless\nTry `{1} {0} --help` for more information.", + "{0}: line buffering stdin is meaningless\nTry '{1} {0} --help' for more information.", ts.util_name, ts.bin_path.to_string_lossy() )); diff --git a/tests/by-util/test_unlink.rs b/tests/by-util/test_unlink.rs index 0c82b6a39..36c978734 100644 --- a/tests/by-util/test_unlink.rs +++ b/tests/by-util/test_unlink.rs @@ -24,7 +24,7 @@ fn test_unlink_multiple_files() { at.touch(file_b); ucmd.arg(file_a).arg(file_b).fails().stderr_is(&format!( - "{0}: extra operand: 'test_unlink_multiple_file_b'\nTry `{1} {0} --help` for more information.", + "{0}: extra operand: 'test_unlink_multiple_file_b'\nTry '{1} {0} --help' for more information.", ts.util_name, ts.bin_path.to_string_lossy() ));