1 pgindent will indent .c and .h files according to the coding standards of
2 the PostgreSQL project. It needs several things to run, and tries to locate
3 or build them if possible. They can also be specified via command line switches
6 You can see all the options by running:
10 In its simplest form, if all the required objects are installed, simply run
11 it at the top of the source tree you want to process like this:
15 If your pg_bsd_indent program is not installed in your path, you can specify
16 it by setting the environment variable INDENT, or PGINDENT, or by giving the
17 command line option --indent:
19 pgindent --indent=/opt/extras/bsdindent
21 pgindent also needs a file containing a list of typedefs. This can be
22 specified using the PGTYPEDEFS environment variable, or via the command line
23 --typedefs option. If neither is used, it will look for it within the
24 current source tree, or in /usr/local/etc/typedefs.list.
26 We don't want to indent certain files in the PostgreSQL source. pgindent
27 will honor a file containing a list of patterns of files to avoid. This
28 file can be specified using the --excludes command line option. If indenting
29 a PostgreSQL source tree, this option is usually not necessary, as it will
30 find the file src/tools/pgindent/exclude_file_patterns. The --excludes option
31 can be used more than once to specify multiple files containing exclusion
34 There are also two non-destructive modes of pgindent. If given the --diff
35 option pgindent will show the changes it would make, but doesn't actually make
36 them. If given instead the --check option, pgindent will exit with a status of
37 2 if it finds any indent changes are required, but will not make the changes.
38 This mode is intended for possible use in a git pre-commit hook. The --check
39 and --diff options can be combined. An example of its use in a git hook can be
40 seen at https://wiki.postgresql.org/wiki/Working_with_Git#Using_git_hooks
42 Any non-option arguments are taken as the names of files to be indented. In this
43 case only these files will be changed, and nothing else will be touched.