patchutils icon indicating copy to clipboard operation
patchutils copied to clipboard

filterdiff should have an --in-place option

Open vapier opened this issue 3 years ago • 1 comments

i often have to write loops like for x in *.patch; do filterdiff ... $x > f; mv f $x; done. would be super handy if i could just run filterdiff --in-place *.patch.

i picked --in-place because that's what sed uses. but -i is already taken by --include, so maybe it'd be -w --write with --in-place as an alias ?

vapier avatar Dec 06 '21 08:12 vapier

I have written this trivial script moddiff for the same purpose:

#!/bin/bash
set -eu

TEMPFILE=$(mktemp /tmp/moddiff.XXXXXX.patch)
trap 'rm -f $TEMPFILE' EXIT

ARGS=("$@")

filterdiff "${ARGS[@]}" >$TEMPFILE
mv $TEMPFILE "${ARGS[-1]}"

so I can then run something like (in fish):

for pf in *.patch
    moddiff -p1 -i 'lexers/*' -x '*.properties' $pf
end

I wouldn’t have a problem if it was included in this package, and just to be sure, I release this triviality to the public domain.

mcepl avatar Feb 16 '23 13:02 mcepl