Home > linux, script > Bash script to fix indentation for C++ code

Bash script to fix indentation for C++ code

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

Usage:

  1. Drop one or more C++ source files in the “toindent” folder
  2. Run the script “./indenter.sh 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: “indent.sh file.cpp”
  • Select all files in the ‘toindent’ folder: “./indent.sh toindent/”
  • Select only files with a certain extension in a folder (e.g. “.h”):  “./indent.sh toindent h”

Download

Indentations options can be changed in the “bcpp_indenter.cfg” file.

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: