mofmt

Crates.iomofmt
lib.rsmofmt
version0.6.0
sourcesrc
created_at2024-02-05 16:57:05.540762
updated_at2024-12-10 20:05:36.549267
descriptionModelica language formatter
homepage
repositoryhttps://github.com/ErykMroczek/mofmt
max_upload_size
id1127753
size228,203
Eryk Mroczek (ErykMroczek)

documentation

README

mofmt - Modelica code formatter

mofmt is a code formatter for Modelica language. It aims to enhance readability and provide style constistency across different Modelica projects.

Code style applied by the mofmt is described in code-style.md.

mofmt assumes that files are encoded as UTF-8 (without BOM). Other encoding will cause it to panic.

Installation and usage

Installation

mofmt can be installed with cargo:

cargo install mofmt

or you can just grab one of the released libraries.

On top of that, repo contains a necessary pre-commit-hooks.yaml file, so if you are using Git, you can delegate running mofmt to pre-commit framework.

Usage

mofmt expects one or more paths that point to either Modelica source files, or to directories with such files:

mofmt <PATHS>

So you can format a single file:

mofmt foo.mo

or multiple files:

mofmt foo.mo bar.mo baz.mo

or all files inside the directory (mofmt searches for files recursively):

mofmt ./foo-dir

or all files inside multiple directories

mofmt ./foo-dir ./bar-dir

or you can mix both files and directories:

mofmt ./foo-dir foo.mo bar.mo ./bar-dir baz.mo

mofmt can run in check mode. In this mode files are not modified, instead mofmt checks the formatting in the original file, and reports an error in case of a failure:

mofmt --check <PATHS>

TODO

[ ] include HTML pretty-printer

License

MPL-2.0

Authors

Eryk Mroczek: mroczek.eryk@gmail.com

Commit count: 286

cargo fmt