5

I would like to format only a part of a sourcefile, like a function instead of the whole file.

This is needed because i can't format the old source completle. Only the newly added functions or changes in functions should be auto formated through uncrustify.

Is a selection based formating possible with uncrustify?

Maybe it is possible to do a automatic formatting of each function which is changed through a combination of git diff --function-context and a uncrustify call.

git diff --function-context | uncrustify -xyc

donkeysoft
  • 51
  • 2

1 Answers1

0

You could go the other way. Save the output of git diff --function-context, then reformat the whole file, then revert the changes in lines which are not part of git diff --function-context.

teki
  • 2,032
  • 1
  • 12
  • 6