Repository navigation
xargs: attach short values for every require_equals option - #1026
emirmrkaljevic wants to merge 2 commits into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1026 +/- ##
==========================================
- Coverage 92.44% 92.43% -0.01%
==========================================
Files 38 38
Lines 8896 8901 +5
Branches 440 440
==========================================
+ Hits 8224 8228 +4
Misses 532 532
- Partials 140 141 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Commit abf3453 has test result changes: GNU findutils testsuite: |
Merging this PR will not alter performance1 warning
Comparing |
| None => continue, | ||
| Some(true) => next_is_value = value.is_empty(), | ||
| Some(false) => { | ||
| if option.is_require_equals_set() && !value.is_empty() { |
There was a problem hiding this comment.
-l also takes an optional attached value but has no require_equals, so xargs -l echo probably takes echo as its value.
should it get the same treatment?
There was a problem hiding this comment.
Yes, good catch. xargs -l echo failed with "invalid value 'echo'" while GNU runs echo with one line per command. In 9defd43 -l gets require_equals too, so -l2 still works, -l echo treats echo as the command, and -l=2 is rejected as an invalid number like GNU. Added xargs_max_lines_l_value_must_be_attached.
|
sorry but it needs to be rebased |
9defd43 to
c48b626
Compare
|
Rebased on main now that #993 is merged, so only the two commits for this PR are left. The |
|
Commit c48b626 has test result changes: GNU findutils testsuite: |
Check is_require_equals_set() instead of the -e id, so -iVALUE is
rewritten to -i=VALUE too. Like GNU, -i={} now uses '={}' as the
replace string.
c48b626 to
3fabdb9
Compare
|
Commit 3fabdb9 has test result changes: GNU findutils testsuite: |
Follow-up to #993.
As suggested in review there, the attached-value rewrite now checks
option.is_require_equals_set()instead of the-eid. So-igets the same treatment:-i_is rewritten to-i=_and works, instead of failing because clap reads the attached value as more short options.This also makes
-i={}match GNU, where everything after-iis the replace string, including the=:The
xargs_replacetest expectedfoo barthere, so I updated it to the GNU output, added a={} barcase that does get replaced, and switched the other-i=_cases to-i_. I checked the outputs against GNU xargs 4.10.0. #1020 also rewrites-iX, but keeps-i=XasX.I found this with behave (https://github.com/emirmrkaljevic/behave).