fprettier is both an executable binary that can be run, and a library that can be used in Rust programs.
Installing the command-line executable
Assuming you have Rust/Cargo installed , run this command in a terminal:
cargo install fprettier
It will make the fprettier command available in your PATH if you've allowed the PATH to be modified when installing Rust . cargo uninstall fprettier uninstalls.
Adding fprettier library as a dependency
Run this command in a terminal, in your project's directory:
cargo add fprettier
To add it manually, edit your project's Cargo.toml file and add to the [dependencies] section:
fprettier = "0.2.0"
The fprettier library will be automatically available globally.
Read the fprettier library documentation .
Back to the crate overview .
Readme
fprettier
fprettier is an auto-formatter for Fortran 90+ code.
fprettier is inspired by fprettify but strives to be:
⚡ Fast, especially for large codebases
🔧 Actively maintained, with prompt responses to issues
Installation
First, install Rust and Cargo by following the instructions at:
https://rustup.rs
Then install fprettier :
cargo install fprettier
Usage
Run fprettier with no arguments to display the usage information.
Revision History
Version 0.2.0
New Features:
Added support for C preprocessor directives (# if , # ifdef, # endif, etc.) -- preprocessor lines are preserved without formatting and indentation is handled correctly within preprocessor blocks
Bug Fixes:
Fixed alignment in the presence of statement labels
Fixed FORMAT statement continuation alignment
Fixed leading + /- on continuation lines being incorrectly treated as binary operators instead of unary
Fixed spacing around . NOT . operator
Fixed spacing of SELECT TYPE/CASE statements
Fixed indentation of one-line do /end do constructs
Fixed OpenMP (! $OMP ) continuation line handling
Fixed spacing after comma before concatenation operator (// )
Fixed indentation with pre-ampersand continuation style
Fixed END IF recognition after semicolon on same line
Various other whitespace and spacing improvements
Version 0.1.0
Initial release with core formatting capabilities:
Indentation normalization
Keyword case conversion
Whitespace normalization around operators
Line continuation handling
Alignment of trailing comments and inline assignments
TOML configuration file support
In-file directive overrides (! fprettier: )
Parallel processing via Rayon for large codebases
Fypp preprocessor directive support