cut: improve some error messages (#11338)

This commit is contained in:
Daniel Hofstetter
2026-03-15 23:34:07 +01:00
committed by GitHub
parent d66817facb
commit 8cfb32714c
3 changed files with 6 additions and 6 deletions
+3 -3
View File
@@ -109,6 +109,6 @@ cut-error-delimiter-and-whitespace-conflict = invalid input: Only one of --delim
cut-error-delimiter-must-be-single-character = the delimiter must be a single character
cut-error-multiple-mode-args = invalid usage: expects no more than one of --fields (-f), --chars (-c) or --bytes (-b)
cut-error-missing-mode-arg = invalid usage: expects one of --fields (-f), --chars (-c) or --bytes (-b)
cut-error-delimiter-only-with-fields = invalid input: The '--delimiter' ('-d') option only usable if printing a sequence of fields
cut-error-whitespace-only-with-fields = invalid input: The '-w' option only usable if printing a sequence of fields
cut-error-only-delimited-only-with-fields = invalid input: The '--only-delimited' ('-s') option only usable if printing a sequence of fields
cut-error-delimiter-only-with-fields = invalid input: The '--delimiter' ('-d') option can only be used when printing a sequence of fields
cut-error-whitespace-only-with-fields = invalid input: The '-w' option can only be used when printing a sequence of fields
cut-error-only-delimited-only-with-fields = invalid input: The '--only-delimited' ('-s') option can only be used when printing a sequence of fields
+1 -1
View File
@@ -131,7 +131,7 @@ fn test_delimiter_with_byte_and_char() {
new_ucmd!()
.args(&[conflicting_arg, COMPLEX_SEQUENCE.sequence, "-d="])
.fails_with_code(1)
.stderr_is("cut: invalid input: The '--delimiter' ('-d') option only usable if printing a sequence of fields\n")
.stderr_is("cut: invalid input: The '--delimiter' ('-d') option can only be used when printing a sequence of fields\n")
;
}
}
+2 -2
View File
@@ -21,7 +21,7 @@ Index: gnu/tests/cut/cut.pl
+my $inval_fld = "$prog: range '--' was invalid: failed to parse range\n";
+my $inval_pos = "$prog: range '--' was invalid: failed to parse range\n";
+my $no_endpoint = "$prog: range '-' was invalid: invalid range with no endpoint\n";
+my $nofield = "$prog: invalid input: The '--delimiter' ('-d') option only usable if printing a sequence of fields\n";
+my $nofield = "$prog: invalid input: The '--delimiter' ('-d') option can only be used when printing a sequence of fields\n";
my @Tests =
(
@@ -53,7 +53,7 @@ Index: gnu/tests/cut/cut.pl
['y', qw(-s -b4), {IN=>":\n"}, {OUT=>""}, {EXIT=>1},
- {ERR=>"$prog: suppressing non-delimited lines makes sense\n"
- . "\tonly when operating on fields\n$try"}],
+ {ERR=>"$prog: invalid input: The '--only-delimited' ('-s') option only usable if printing a sequence of fields\n"}],
+ {ERR=>"$prog: invalid input: The '--only-delimited' ('-s') option can only be used when printing a sequence of fields\n"}],
# You must specify bytes or fields (or chars)
['z', '', {IN=>":\n"}, {OUT=>""}, {EXIT=>1},
- {ERR=>"$prog: you must specify a list of bytes, characters, or fields\n$try"}