crate-cli 10.11.0

A command-line tool for managing Cargo package lifecycles: version bump, workspace dependency sync, members-ordered publish and code formatting.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use super::*;

/// Formats TOML files matching VS Code `tamasfe.even-better-toml` (Taplo 0.7.0 defaults with 4-space indentation).
///
/// # Arguments
///
/// - `&str` - Raw TOML source text.
///
/// # Returns
///
/// - `String` - Formatted TOML text, or unchanged input if syntax errors occur.
pub fn format_toml(input: &str) -> String {
    let opts: Options = vscode_tidy_options();
    tidy::toml::format(input, &opts.toml).unwrap_or_else(|_: tidy::Error| input.to_string())
}