Skip to content

Python script to enforce formatting rules of C++ and CMake

License

Notifications You must be signed in to change notification settings

YarikTH/pretty.py

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

pretty.py

GitHub license GitHub Releases download PRs Welcome

Python script to enforce formatting rules of C++ and CMake.

Uses clang-format for C++ files and Gersemi for CMake files.

Optionally allows to find project files that require prettifying using GitPython.

This script is mostly intended for personal usage for my projects. But feel free to use it too and give a feedback.

Usage

Just download script using link above and use it. There are no plans to use proper python solutions like pip module etc.

usage: pretty.py [-h] [-c] [--exclude EXCLUDE] [--clang-format CLANG_FORMAT]
                 [--gersemi GERSEMI]
                 [src [src ...]]

A formatter to make your C++ and CMake code the real treasure.

positional arguments:
  src                   Files to format. Special value "-" to automatically
                        detect project files

optional arguments:
  -h, --help            show this help message and exit
  -c, --check           Check if files require reformatting. Return 0 when
                        there's nothing to reformat, return 1 when some files
                        would be reformatted
  --exclude EXCLUDE     Files and directories to exclude from formatting
  --clang-format CLANG_FORMAT
                        Clang format to use for C++ files
  --gersemi GERSEMI     Gersemi to use for CMake files