gitshellastyle

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


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?


Solution

  • Also for Bash:

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

    $() is command substitution.