Home > Blockchain >  How to run astyle over the list of files specified by git diff --name-only
How to run astyle over the list of files specified by git diff --name-only

Time:09-23

Running git diff --name-only gives me a list of files like this

file1
file2

Astyle usage goes something like this

astyle.exe --options=myoptionsfile <file1> <file2>

Instead of specifying each file manually I'd like a way to pipe the output of git diff --name-only as the list of files specified in the astyle program call.

Anyone know how to do this?

CodePudding user response:

What about using Git Bash or cygwin or any linux emulator on windows:

git diff --name-only | xargs astyle.exe --options=myoptionsfile

You can also do it using Powershell.

CodePudding user response:

Also for Bash:

astyle.exe --options=myoptionsfile $(git diff --name-only)

$() is command substitution.

  • Related