pub fn format_source(source: &str, config: &Config) -> Result<String>Expand description
Format raw CMake source using the built-in command registry.
The output always ends with a newline. When
Config::line_ending is LineEnding::Auto, the output line
ending is detected from the input (CRLF if the source contains
any \r\n, otherwise LF).
ยงExamples
use cmakefmt::{format_source, Config};
let cmake = "CMAKE_MINIMUM_REQUIRED(VERSION 3.20)\n";
let formatted = format_source(cmake, &Config::default()).unwrap();
assert_eq!(formatted, "cmake_minimum_required(VERSION 3.20)\n");