diff --git a/CHANGELOG.md b/CHANGELOG.md index 6fb64a70..822e370e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). #### [Unreleased](https://github.com/hougesen/mdsf/compare/v0.2.6...HEAD) +- feat(formatters): support markdownfmt [`#482`](https://github.com/hougesen/mdsf/pull/482) - feat(formatters): support ziggy fmt [`#481`](https://github.com/hougesen/mdsf/pull/481) - feat(formatters): support kulala-fmt [`#480`](https://github.com/hougesen/mdsf/pull/480) - feat(formatters): support superhtml [`#479`](https://github.com/hougesen/mdsf/pull/479) diff --git a/README.md b/README.md index db6d91a5..c00a0c0c 100644 --- a/README.md +++ b/README.md @@ -184,7 +184,7 @@ mdsf init -`mdsf` currently supports 180 tools. Feel free to open an issue/pull-request if your favorite tool is missing! 😃 +`mdsf` currently supports 181 tools. Feel free to open an issue/pull-request if your favorite tool is missing! 😃 | Formatter | Description | | -------------------- | ---------------------------------------------------------------------------------------------------------------------------- | @@ -354,6 +354,7 @@ mdsf init | ts-standard | [https://github.com/standard/ts-standard](https://github.com/standard/ts-standard) | | twig-cs-fixer | [https://github.com/VincentLanglet/Twig-CS-Fixer](https://github.com/VincentLanglet/Twig-CS-Fixer) | | typos | [https://github.com/crate-ci/typos](https://github.com/crate-ci/typos) | +| ufmt | [https://github.com/omnilib/ufmt](https://github.com/omnilib/ufmt) | | uiua_fmt | [https://github.com/uiua-lang/uiua](https://github.com/uiua-lang/uiua) | | usort | [https://github.com/facebook/usort](https://github.com/facebook/usort) | | veryl_fmt | [https://github.com/veryl-lang/veryl](https://github.com/veryl-lang/veryl) | diff --git a/mdsf/src/formatters/mod.rs b/mdsf/src/formatters/mod.rs index dc6d3410..4fc98145 100644 --- a/mdsf/src/formatters/mod.rs +++ b/mdsf/src/formatters/mod.rs @@ -174,6 +174,7 @@ mod topiary; mod ts_standard; mod twig_cs_fixer; mod typos; +mod ufmt; mod uiua; mod usort; mod v; @@ -1026,6 +1027,10 @@ pub enum Tooling { #[serde(rename = "typos")] Typos, + #[doc = "https://github.com/omnilib/ufmt"] + #[serde(rename = "ufmt")] + Ufmt, + #[doc = "https://github.com/uiua-lang/uiua"] #[serde(rename = "uiua_fmt")] UiuaFmt, @@ -1257,6 +1262,7 @@ impl Tooling { Self::TsStandard => ts_standard::run(snippet_path), Self::TwigCsFixer => twig_cs_fixer::run(snippet_path), Self::Typos => typos::run(snippet_path), + Self::Ufmt => ufmt::run(snippet_path), Self::UiuaFmt => uiua::run_fmt(snippet_path), Self::Usort => usort::run(snippet_path), Self::VerylFmt => veryl::run_fmt(snippet_path), @@ -1446,6 +1452,7 @@ impl AsRef for Tooling { Self::TsStandard => "ts-standard", Self::TwigCsFixer => "twig-cs-fixer", Self::Typos => "typos", + Self::Ufmt => "ufmt", Self::UiuaFmt => "uiua_fmt", Self::Usort => "usort", Self::VerylFmt => "veryl_fmt", diff --git a/mdsf/src/formatters/ufmt.rs b/mdsf/src/formatters/ufmt.rs new file mode 100644 index 00000000..74d9fb70 --- /dev/null +++ b/mdsf/src/formatters/ufmt.rs @@ -0,0 +1,11 @@ +use super::execute_command; +use crate::{error::MdsfError, runners::CommandType}; + +#[inline] +pub fn run(snippet_path: &std::path::Path) -> Result<(bool, Option), MdsfError> { + let mut cmd = CommandType::Direct("ufmt").build(); + + cmd.arg("format").arg(snippet_path); + + execute_command(cmd, snippet_path) +} diff --git a/schemas/v0.2.7/mdsf.schema.json b/schemas/v0.2.7/mdsf.schema.json index 0af466fe..33e0fd31 100644 --- a/schemas/v0.2.7/mdsf.schema.json +++ b/schemas/v0.2.7/mdsf.schema.json @@ -888,6 +888,11 @@ "type": "string", "enum": ["typos"] }, + { + "description": "https://github.com/omnilib/ufmt", + "type": "string", + "enum": ["ufmt"] + }, { "description": "https://github.com/uiua-lang/uiua", "type": "string",