diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d64356..2d28725 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## unreleased - Add ability to add `publish` to the generated Cargo.toml file (#208) +- Fix generating publish value as a toml bool (#209) ## [3.0.0] - 2023-04-28 diff --git a/fp-bindgen/src/generators/mod.rs b/fp-bindgen/src/generators/mod.rs index 81a1225..c191927 100644 --- a/fp-bindgen/src/generators/mod.rs +++ b/fp-bindgen/src/generators/mod.rs @@ -97,6 +97,7 @@ pub enum RustPluginConfigValue { String(String), Vec(Vec), Workspace, + Bool(bool), } impl From<&str> for RustPluginConfigValue { @@ -123,6 +124,12 @@ impl From> for RustPluginConfigValue { } } +impl From for RustPluginConfigValue { + fn from(value: bool) -> Self { + Self::Bool(value) + } +} + pub struct RustPluginConfigBuilder { config: RustPluginConfig, } @@ -184,7 +191,7 @@ impl RustPluginConfigBuilder { } pub fn publish(mut self, value: bool) -> Self { - self.config.publish = Some(RustPluginConfigValue::String(value.to_string())); + self.config.publish = Some(value.into()); self } diff --git a/fp-bindgen/src/generators/rust_plugin/mod.rs b/fp-bindgen/src/generators/rust_plugin/mod.rs index f7d4c44..79349e2 100644 --- a/fp-bindgen/src/generators/rust_plugin/mod.rs +++ b/fp-bindgen/src/generators/rust_plugin/mod.rs @@ -592,6 +592,7 @@ fn format_cargo_key(key: &str, value: Option) -> String { inline.insert("workspace", true.into()); toml_edit::value(inline) } + RustPluginConfigValue::Bool(value) => toml_edit::value(value), }; let mut doc = toml_edit::Document::new();