November 28, 2012

Bash script: fix indentation of C++ code

This small scripts allows me fix the indentation of C++ source files with very little effort.


  1. Drop one or more C++ source files in the “toindent” folder
  2. Run the script “./ toindent” (this calls the bcpp indenter to indent all files in the ‘toindent’ folder)
  3. Done

There are some options for step 2: * Select one file to indent: “ file.cpp” * Select all files in the “toindent” folder: “./ toindent/” * Select only files with a certain extension in a folder (e.g. “.h”): “./ toindent h”

Code available: Github