diff --git a/CHANGELOG.md b/CHANGELOG.md index ef5a08b..a593f85 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,9 +6,11 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). #### [Unreleased](https://github.com/hougesen/mdsf/compare/v0.2.6...HEAD) +- 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) - refactor: make language_to_ext return type optional [`#478`](https://github.com/hougesen/mdsf/pull/478) - feat(formatters): support mojo format [`#477`](https://github.com/hougesen/mdsf/pull/477) +- feat(formatters): support kulala-fmt (#480) [`#157`](https://github.com/hougesen/mdsf/issues/157) - chore: bump dev version to 0.2.7 [`305275a`](https://github.com/hougesen/mdsf/commit/305275a64ae2aa8b60c2dca463412361cf6d02ee) #### [v0.2.6](https://github.com/hougesen/mdsf/compare/v0.2.5...v0.2.6) diff --git a/README.md b/README.md index a1b1de0..1786765 100644 --- a/README.md +++ b/README.md @@ -184,7 +184,7 @@ mdsf init -`mdsf` currently supports 178 tools. Feel free to open an issue/pull-request if your favorite tool is missing! 😃 +`mdsf` currently supports 179 tools. Feel free to open an issue/pull-request if your favorite tool is missing! 😃 | Formatter | Description | | -------------------- | ---------------------------------------------------------------------------------------------------------------------------- | @@ -365,6 +365,7 @@ mdsf init | yapf | [https://github.com/google/yapf](https://github.com/google/yapf) | | yew-fmt | [https://github.com/its-the-shrimp/yew-fmt](https://github.com/its-the-shrimp/yew-fmt) | | zigfmt | [https://ziglang.org/](https://ziglang.org/) | +| ziggy_fmt | [https://ziggy-lang.io/documentation/ziggy-fmt/](https://ziggy-lang.io/documentation/ziggy-fmt/) | | zprint | [https://github.com/kkinnear/zprint](https://github.com/kkinnear/zprint) | diff --git a/mdsf/src/formatters/mod.rs b/mdsf/src/formatters/mod.rs index 582a6b8..14ef720 100644 --- a/mdsf/src/formatters/mod.rs +++ b/mdsf/src/formatters/mod.rs @@ -185,6 +185,7 @@ mod yamlfmt; mod yapf; mod yew_fmt; mod zigfmt; +mod ziggy; mod zprint; #[inline] @@ -1068,6 +1069,10 @@ pub enum Tooling { #[serde(rename = "zigfmt")] ZigFmt, + #[doc = "https://ziggy-lang.io/documentation/ziggy-fmt/"] + #[serde(rename = "ziggy_fmt")] + ZiggyFmt, + #[doc = "https://github.com/kkinnear/zprint"] #[serde(rename = "zprint")] Zprint, @@ -1099,10 +1104,10 @@ impl Tooling { Self::BladeFormatter => blade_formatter::run(snippet_path), Self::Blue => blue::run(snippet_path), Self::Bpfmt => bpfmt::run(snippet_path), + Self::Brittany => brittany::run(snippet_path), Self::Bsfmt => bsfmt::run(snippet_path), Self::Buf => buf::run(snippet_path), Self::Buildifier => buildifier::run(snippet_path), - Self::Brittany => brittany::run(snippet_path), Self::CSharpier => csharpier::run(snippet_path), Self::CabalFormat => cabal_format::run(snippet_path), Self::CaramelFmt => caramel::run_fmt(snippet_path), @@ -1117,13 +1122,13 @@ impl Tooling { Self::Csscomb => csscomb::run(snippet_path), Self::D2 => d2::run(snippet_path), Self::DFmt => dfmt::run(snippet_path), - Self::Dhall => dhall::run(snippet_path), Self::DartFix => dart::run_fix(snippet_path), Self::DartFormat => dart::run_format(snippet_path), Self::DcmFix => dcm::run_fix(snippet_path), Self::DcmFormat => dcm::run_format(snippet_path), Self::DenoFmt => deno::run_fmt(snippet_path), Self::DenoLint => deno::run_lint(snippet_path), + Self::Dhall => dhall::run(snippet_path), Self::DjLint => djlint::run(snippet_path), Self::Docformatter => docformatter::run(snippet_path), Self::Docstrfmt => docstrfmt::run(snippet_path), @@ -1139,11 +1144,11 @@ impl Tooling { Self::Findent => findent::run(snippet_path), Self::FishIndent => fish_indent::run(snippet_path), Self::Fixjson => fixjson::run(snippet_path), + Self::Floskell => floskell::run(snippet_path), Self::Fnlfmt => fnlfmt::run(snippet_path), Self::ForgeFmt => forge_fmt::run(snippet_path), Self::Fourmolu => fourmolu::run(snippet_path), Self::Fprettify => fprettify::run(snippet_path), - Self::Floskell => floskell::run(snippet_path), Self::GCI => gci::run(snippet_path), Self::Gdformat => gdformat::run(snippet_path), Self::Gersemi => gersemi::run(snippet_path), @@ -1157,8 +1162,8 @@ impl Tooling { Self::GoogleJavaFormat => google_java_format::run(snippet_path), Self::GrainFormat => grain::run_format(snippet_path), Self::HIndent => hindent::run(snippet_path), - Self::Hfmt => hfmt::run(snippet_path), Self::HamlLint => haml_lint::run(snippet_path), + Self::Hfmt => hfmt::run(snippet_path), Self::HtmlBeautify => html_beautify::run(snippet_path), Self::Htmlbeautifier => htmlbeautifier::run(snippet_path), Self::ImbaFmt => imba::run_fmt(snippet_path), @@ -1206,8 +1211,8 @@ impl Tooling { Self::Prisma => prisma::run_format(snippet_path), Self::PuppetLint => puppet_lint::run(snippet_path), Self::PursTidy => purs_tidy::run(snippet_path), - Self::Pycln => pycln::run(snippet_path), Self::PyInk => pyink::run(snippet_path), + Self::Pycln => pycln::run(snippet_path), Self::Qmlfmt => qmlfmt::run(snippet_path), Self::RacoFmt => raco::run_fmt(snippet_path), Self::ReScriptFormat => rescript_format::run(snippet_path), @@ -1232,8 +1237,8 @@ impl Tooling { Self::Sqlfmt => sqlfmt::run(snippet_path), Self::Standardjs => standardjs::run(snippet_path), Self::Standardrb => standardrb::run(snippet_path), - Self::Stylefmt => stylefmt::run(snippet_path), Self::StyleLint => stylelint::run(snippet_path), + Self::Stylefmt => stylefmt::run(snippet_path), Self::StylishHaskell => stylish_haskell::run(snippet_path), Self::Stylua => stylua::run(snippet_path), Self::SuperhtmlFmt => superhtml::run_fmt(snippet_path), @@ -1258,6 +1263,7 @@ impl Tooling { Self::Yapf => yapf::run(snippet_path), Self::YewFmt => yew_fmt::run(snippet_path), Self::ZigFmt => zigfmt::run(snippet_path), + Self::ZiggyFmt => ziggy::run_fmt(snippet_path), Self::Zprint => zprint::run(snippet_path), } } @@ -1286,10 +1292,10 @@ impl AsRef for Tooling { Self::BladeFormatter => "blade-formatter", Self::Blue => "blue", Self::Bpfmt => "bpfmt", + Self::Brittany => "brittany", Self::Bsfmt => "bsfmt", Self::Buf => "buf", Self::Buildifier => "buildifier", - Self::Brittany => "brittany", Self::CSharpier => "csharpier", Self::CabalFormat => "cabal_format", Self::CaramelFmt => "caramel_fmt", @@ -1300,20 +1306,23 @@ impl AsRef for Tooling { Self::Codespell => "codespell", Self::CrlFmt => "crlfmt", Self::CrystalFormat => "crystal_format", + Self::CssBeautify => "css-beautify", + Self::Csscomb => "csscomb", Self::D2 => "d2", Self::DFmt => "dfmt", - Self::Dhall => "dhall", - Self::DartFormat => "dart_format", Self::DartFix => "dart_fix", + Self::DartFormat => "dart_format", + Self::DcmFix => "dcm_fix", + Self::DcmFormat => "dcm_format", Self::DenoFmt => "deno_fmt", Self::DenoLint => "deno_lint", + Self::Dhall => "dhall", Self::DjLint => "djlint", - Self::DcmFormat => "dcm_format", - Self::DcmFix => "dcm_fix", Self::Docformatter => "docformatter", Self::Docstrfmt => "docstrfmt", Self::DotenvLinter => "dotenv-linter", Self::Dprint => "dprint", + Self::EasyCodingStandard => "easy-coding-standard", Self::Efmt => "efmt", Self::ElmFormat => "elm-format", Self::ErbFormatter => "erb-formatter", @@ -1323,11 +1332,11 @@ impl AsRef for Tooling { Self::Findent => "findent", Self::FishIndent => "fish_indent", Self::Fixjson => "fixjson", + Self::Floskell => "floskell", Self::Fnlfmt => "fnlfmt", Self::ForgeFmt => "forge_fmt", Self::Fourmolu => "fourmolu", Self::Fprettify => "fprettify", - Self::Floskell => "floskell", Self::GCI => "gci", Self::Gdformat => "gdformat", Self::Gersemi => "gersemi", @@ -1341,16 +1350,18 @@ impl AsRef for Tooling { Self::GoogleJavaFormat => "google-java-format", Self::GrainFormat => "grain_format", Self::HIndent => "hindent", - Self::Hfmt => "hfmt", Self::HamlLint => "haml-lint", + Self::Hfmt => "hfmt", + Self::HtmlBeautify => "html-beautify", Self::Htmlbeautifier => "htmlbeautifier", Self::ImbaFmt => "imba_fmt", Self::Isort => "isort", Self::Joker => "joker", - Self::JuliaFormatterJl => "juliaformatter.jl", - Self::JustFmt => "just_fmt", + Self::JsBeautify => "js-beautify", Self::JsonaFormat => "jsona_format", Self::Jsonnetfmt => "jsonnetfmt", + Self::JuliaFormatterJl => "juliaformatter.jl", + Self::JustFmt => "just_fmt", Self::KclFmt => "kcl_fmt", Self::Kdlfmt => "kdlfmt", Self::Ktfmt => "ktfmt", @@ -1379,12 +1390,17 @@ impl AsRef for Tooling { Self::PackerFmt => "packer_fmt", Self::PerlTidy => "perltidy", Self::PgFormat => "pg_format", + Self::PhpCsFixer => "php-cs-fixer", + Self::Phpcbf => "phpcbf", + Self::Phpinsights => "phpinsights", + Self::Pint => "pint", Self::Prettier => "prettier", + Self::PrettyPhp => "pretty-php", Self::Prisma => "prisma", Self::PuppetLint => "puppet-lint", Self::PursTidy => "purs-tidy", - Self::Pycln => "pycln", Self::PyInk => "pyink", + Self::Pycln => "pycln", Self::Qmlfmt => "qmlfmt", Self::RacoFmt => "raco_fmt", Self::ReScriptFormat => "rescript_format", @@ -1409,22 +1425,24 @@ impl AsRef for Tooling { Self::Sqlfmt => "sqlfmt", Self::Standardjs => "standardjs", Self::Standardrb => "standardrb", - Self::Stylefmt => "stylefmt", Self::StyleLint => "stylelint", + Self::Stylefmt => "stylefmt", Self::StylishHaskell => "stylish-haskell", Self::Stylua => "stylua", Self::SuperhtmlFmt => "superhtml_fmt", Self::Taplo => "taplo", Self::Templ => "templ", Self::TerraformFmt => "terraform_fmt", + Self::Tlint => "tlint", Self::TofuFmt => "tofu_fmt", Self::Topiary => "topiary", Self::TsStandard => "ts-standard", + Self::TwigCsFixer => "twig-cs-fixer", Self::Typos => "typos", Self::UiuaFmt => "uiua_fmt", Self::Usort => "usort", - Self::VlangFmt => "vlang_fmt", Self::VerylFmt => "veryl_fmt", + Self::VlangFmt => "vlang_fmt", Self::XmlFormat => "xmlformat", Self::XmlLint => "xmllint", Self::Xo => "xo", @@ -1433,19 +1451,8 @@ impl AsRef for Tooling { Self::Yapf => "yapf", Self::YewFmt => "yew-fmt", Self::ZigFmt => "zigfmt", + Self::ZiggyFmt => "ziggy_fmt", Self::Zprint => "zprint", - Self::CssBeautify => "css-beautify", - Self::Csscomb => "csscomb", - Self::EasyCodingStandard => "easy-coding-standard", - Self::HtmlBeautify => "html-beautify", - Self::JsBeautify => "js-beautify", - Self::PhpCsFixer => "php-cs-fixer", - Self::Phpcbf => "phpcbf", - Self::Phpinsights => "phpinsights", - Self::Pint => "pint", - Self::PrettyPhp => "pretty-php", - Self::Tlint => "tlint", - Self::TwigCsFixer => "twig-cs-fixer", } } } diff --git a/mdsf/src/formatters/ziggy.rs b/mdsf/src/formatters/ziggy.rs new file mode 100644 index 0000000..5b6db86 --- /dev/null +++ b/mdsf/src/formatters/ziggy.rs @@ -0,0 +1,11 @@ +use super::execute_command; +use crate::{error::MdsfError, runners::CommandType}; + +#[inline] +pub fn run_fmt(file_path: &std::path::Path) -> Result<(bool, Option), MdsfError> { + let mut cmd = CommandType::Direct("ziggy").build(); + + cmd.arg("fmt").arg(file_path); + + execute_command(cmd, file_path) +} diff --git a/schemas/v0.2.7/mdsf.schema.json b/schemas/v0.2.7/mdsf.schema.json index 0f14533..fb0f50d 100644 --- a/schemas/v0.2.7/mdsf.schema.json +++ b/schemas/v0.2.7/mdsf.schema.json @@ -943,6 +943,11 @@ "type": "string", "enum": ["zigfmt"] }, + { + "description": "https://ziggy-lang.io/documentation/ziggy-fmt/", + "type": "string", + "enum": ["ziggy_fmt"] + }, { "description": "https://github.com/kkinnear/zprint", "type": "string",