main
https://sourceforge.net/p/astyle/bugs/467/ fixed indent of brace initializers within constructor init list
This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
= Artistic Style
:toc: macro
:toc-title: Contents
Artistic Style is a source code indenter, formatter, and beautifier for the C, pass:[C++], pass:[C++]/CLI, Objective‑C, C#, Java, JavaScript and GSC programming languages.
Written in pass:[C++], it can be used from the command line or incorporated as a library in another program.
Options can be entered from the command line or from an option file.
The library version can be called from programs written in languages other than pass:[C++].
toc::[]
== Features
* Predefined brace styles such as Allman, Java, K&R, Stroustrup, Whitesmith, GNU, Linux, Google, Mozilla, WebKit, VTK and more
* Indentation with spaces or tabs, including indentation of classes, namespaces, switch blocks, cases, labels, preprocessor blocks and lambda bodies
* Padding and unpadding of operators, parentheses, brackets, commas and headers
* Alignment of pointers and references (`type`, `middle`, `name`)
* Adding or removing braces, breaking or attaching blocks, wrapping long lines (`--max-code-length`)
* Support for modern pass:[C++] constructs up to pass:[C++]20/23/26 (lambdas, concepts and requires-expressions, modules, `if consteval`, contracts)
* Handling of UTF-8 and UTF-16 encoded files, recursive processing of directory trees, backup files and dry runs
* Option files per user and per project, plus ready-made presets for many popular code styles
== Quick start
[source,bash]
----
# Format a single file with the Allman style and 4 space indentation
astyle --style=allman --indent=spaces=4 main.cpp
# Format a source tree recursively without creating backup files
astyle --style=google --suffix=none --recursive "src/*.cpp" "src/*.h"
# Show what would change without modifying any file
astyle --dry-run --style=kr --recursive "*.c"
# Fail with a non-zero exit code if formatting would change a file (useful in CI)
astyle --dry-run --error-on-changes --options=AStyle/file/google.ini --recursive "*.cpp"
----
Run `astyle --help` for the complete list of options or see the documentation in link:AStyle/doc/astyle.html[`AStyle/doc/astyle.html`].
== Building
Artistic Style requires a pass:[C++]17 compiler and CMake 3.10 or later.
[source,bash]
----
cd AStyle
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build
build/astyle --version
----
Additional CMake options:
[cols="1,3"]
|===
| Option | Result
| `-DBUILD_SHARED_LIBS=ON` | Build the shared library exporting `AStyleMain()`, `AStyleMainUtf16()` and `AStyleGetVersion()`
| `-DBUILD_STATIC_LIBS=ON` | Build the static library
| `-DBUILD_JAVA_LIBS=ON` | Build the Java JNI library
|===
A plain GCC Makefile is available in `AStyle/build/gcc`, and project files for other IDEs and compilers are located in `AStyle/build`.
Detailed instructions are given in link:AStyle/doc/install.html[`AStyle/doc/install.html`].
== Testing
The GitLab CI pipeline builds the command line tool and runs the regression tests for each predefined style.
To run them locally after building:
[source,bash]
----
cd AStyleTest/regression-sh
bash ./run_tests.sh
----
== Documentation
* link:AStyle/doc/astyle.html[Usage and options]
* link:AStyle/doc/install.html[Installation]
* link:AStyle/doc/news.html[News] and link:AStyle/doc/notes.html[Release notes]
* link:AStyle/file/README.md[Style presets]
== Repositories
The home of Artistic Style is http://sourceforge.net/projects/astyle/. As nowadays git is more accepted for collaborative development, this git repo is used for day to day development and merge requests.
The SVN repo and download section at SF.net will be updated regularly.
Bug reports and feature requests are welcome in the https://gitlab.com/saalen/astyle/-/issues[GitLab issue tracker] or the https://sourceforge.net/p/astyle/bugs/[SourceForge bug tracker].
== License
Artistic Style is licensed under the link:AStyle/LICENSE.md[MIT License].
== Maintainers
Artistic Style is maintained and updated by Andre Simon.
Previous maintainer: Jim Pattee. The original author was Tal Davidson, Israel.
Description
DEPENDENCY: Artistic Style automatic source code formatter (https://sourceforge.net/projects/astyle)
https://brlcad.org/
5.9 MiB
0 Stars
3 Watchers
0 Forks
Languages
C++
67.6%
HTML
14.1%
Python
9.4%
Batchfile
3.5%
Shell
1.7%
Other
3.6%