Add TOML migration recommendation to warning

This adds a little recommendation to use `alacritty migrate` to
automatically transition configuration files from YAML to TOML.
This commit is contained in:
Christian Duerr 2023-06-26 00:07:41 +02:00 committed by GitHub
parent 43b7c1774c
commit 9fcdb059bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -228,7 +228,9 @@ pub fn deserialize_config(path: &Path) -> Result<Value> {
// Convert YAML to TOML as a transitionary fallback mechanism. // Convert YAML to TOML as a transitionary fallback mechanism.
let extension = path.extension().unwrap_or_default(); let extension = path.extension().unwrap_or_default();
if (extension == "yaml" || extension == "yml") && !contents.trim().is_empty() { if (extension == "yaml" || extension == "yml") && !contents.trim().is_empty() {
warn!("YAML config {path:?} is deprecated, please migrate to TOML"); warn!(
"YAML config {path:?} is deprecated, please migrate to TOML using `alacritty migrate`"
);
let value: serde_yaml::Value = serde_yaml::from_str(&contents)?; let value: serde_yaml::Value = serde_yaml::from_str(&contents)?;
contents = toml::to_string(&value)?; contents = toml::to_string(&value)?;