Skip to content
Open
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions src/xargs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1006,6 +1006,7 @@ fn do_xargs(args: &[&str]) -> Result<CommandResult, XargsError> {
Arg::new(options::REPLACE_I)
.short('I')
.num_args(1)
.allow_hyphen_values(true)
.value_name("R")
.help(
"Replace R in initial arguments with names read from standard input; \
Expand All @@ -1019,6 +1020,7 @@ fn do_xargs(args: &[&str]) -> Result<CommandResult, XargsError> {
Arg::new(options::EOF)
.short('E')
.num_args(1)
.allow_hyphen_values(true)
.value_name("eof-string")
.help(
"If specified, stop processing the input upon reaching an input \
Expand All @@ -1031,6 +1033,7 @@ fn do_xargs(args: &[&str]) -> Result<CommandResult, XargsError> {
.short('e')
.long(options::EOF)
.num_args(0..=1)
.allow_hyphen_values(true)
.value_name("eof-string")
.help("Alias for -E")
.overrides_with(options::EOF)
Expand Down
12 changes: 12 additions & 0 deletions tests/test_xargs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,12 @@ fn xargs_replace() {
.succeeds()
.stdout_contains("{} bar foo");

ucmd()
.args(&["-I", "-_", "echo", "-_ bar"])
.pipe_in("foo")
.succeeds()
.stdout_contains("foo bar");

// Expected to fail
ucmd()
.args(&["-I", "echo", "_ _ bar"])
Expand Down Expand Up @@ -485,6 +491,12 @@ fn xargs_eof() {
.succeeds()
.stdout_only("ab\n");
}

ucmd()
.args(&["-E", "-end"])
.pipe_in("ab -end ef")
.succeeds()
.stdout_only("ab\n");
}

#[test]
Expand Down
Loading