Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sort multiple output files - Issue #7183 #7199

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/uu/sort/src/sort.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1026,6 +1026,14 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
}
};

// Add check for multiple output files early in the function
if matches.get_many::<String>(options::OUTPUT).map_or(0, |v| v.count()) > 1 {
return Err(USimpleError::new(
1,
"multiple output files specified"
));
}

settings.debug = matches.get_flag(options::DEBUG);

// check whether user specified a zero terminated list of files for input, otherwise read files from args
Expand Down Expand Up @@ -1417,7 +1425,8 @@ pub fn uu_app() -> Command {
.long(options::OUTPUT)
.help("write output to FILENAME instead of stdout")
.value_name("FILENAME")
.value_hint(clap::ValueHint::FilePath),
.value_hint(clap::ValueHint::FilePath)
.action(ArgAction::Append),
)
.arg(
Arg::new(options::REVERSE)
Expand Down
Loading