cmakefmt

Crates.iocmakefmt
lib.rscmakefmt
version0.1.11
sourcesrc
created_at2023-12-10 08:05:20.528575
updated_at2024-01-15 09:45:36.570548
descriptionGood enough (MVP, early) CMake auto formatter.
homepage
repositoryhttps://github.com/yamadapc/cmakefmt
max_upload_size
id1064085
size111,699
Pedro Tacla Yamada (yamadapc)

documentation

README

cmakefmt

Crates.io Version


Good enough CMake auto formatter. No settings, prints to STDOUT.

Install

cargo install cmakefmt

Usage

cmakefmt <file>

State

  • Basic syntax is handled and prints
  • Error handling prints nice error messages, but it's very verbose and sometimes the true parsing error is deeper into the file
  • Ignores commas after quoted string literals since that just breaks string commands and isn't valid syntax
  • Fails to parse conditional expressions if comments are put before a binary conditional operator (AND/OR etc.)

Rules

  • Statements and commands are printed in one line or break into multiple lines if there isn't space
  • Command arguments are broken into one line each, unless they are an upper-case word. In case an argument is an upper-case word, it creates a group with all the following non-uppercase arguments. This helps format key-value style bringings.
  • Group-like statements (foreach, if, block, macro) indent their children

License

MIT

Commit count: 43

cargo fmt