Skip to content

Commit 6cde13e

Browse files
mattsu2020sylvestre
authored andcommitted
fix(sort): skip ordering incompatibility check when --key is specified
Previously, the ordering_incompatible check was performed unconditionally, causing errors even when the --key option was used, where such incompatibilities might not apply. This change adds a condition to skip the check if --key is present, ensuring correct behavior for key-based sorting.
1 parent ce96a26 commit 6cde13e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/uu/sort/src/sort.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2081,7 +2081,9 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
20812081
let ignore_non_printing = matches.get_flag(options::IGNORE_NONPRINTING);
20822082
let ignore_case = matches.get_flag(options::IGNORE_CASE);
20832083

2084-
if ordering_incompatible(mode_flags, dictionary_order, ignore_non_printing) {
2084+
if !matches.contains_id(options::KEY)
2085+
&& ordering_incompatible(mode_flags, dictionary_order, ignore_non_printing)
2086+
{
20852087
let opts = ordering_opts_string(
20862088
mode_flags,
20872089
dictionary_order,

0 commit comments

Comments
 (0)