Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(formatters): support prettytypst #487

Merged
merged 1 commit into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 vhdl-style-guide [`#486`](https://github.com/hougesen/mdsf/pull/486)
- feat(formatters): support typstyle [`#485`](https://github.com/hougesen/mdsf/pull/485)
- feat(formatters): support typstfmt [`#484`](https://github.com/hougesen/mdsf/pull/484)
- feat(formatters): support ufmt [`#483`](https://github.com/hougesen/mdsf/pull/483)
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ mdsf init

<!-- START_SECTION:supported-tools -->

`mdsf` currently supports 184 tools. Feel free to open an issue/pull-request if your favorite tool is missing! 😃
`mdsf` currently supports 185 tools. Feel free to open an issue/pull-request if your favorite tool is missing! 😃

| Formatter | Description |
| -------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
Expand Down Expand Up @@ -309,6 +309,7 @@ mdsf init
| pint | [https://github.com/laravel/pint](https://github.com/laravel/pint) |
| prettier | [https://github.com/prettier/prettier](https://github.com/prettier/prettier) |
| pretty-php | [https://github.com/lkrms/pretty-php](https://github.com/lkrms/pretty-php) |
| prettypst | [https://github.com/antonWetzel/prettypst](https://github.com/antonWetzel/prettypst) |
| prisma | [https://prisma.io/](https://prisma.io/) |
| puppet-lint | [https://github.com/puppetlabs/puppet-lint](https://github.com/puppetlabs/puppet-lint) |
| purs-tidy | [https://github.com/natefaubion/purescript-tidy](https://github.com/natefaubion/purescript-tidy) |
Expand Down
7 changes: 7 additions & 0 deletions mdsf/src/formatters/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ mod phpinsights;
mod pint;
mod prettier;
mod pretty_php;
mod prettypst;
mod prisma;
mod puppet_lint;
mod purs_tidy;
Expand Down Expand Up @@ -850,6 +851,10 @@ pub enum Tooling {
#[serde(rename = "pretty-php")]
PrettyPhp,

#[doc = "https://github.com/antonWetzel/prettypst"]
#[serde(rename = "prettypst")]
Prettypst,

#[doc = "https://prisma.io/"]
#[serde(rename = "prisma")]
Prisma,
Expand Down Expand Up @@ -1234,6 +1239,7 @@ impl Tooling {
Self::Pint => pint::run(snippet_path),
Self::Prettier => prettier::run(snippet_path),
Self::PrettyPhp => pretty_php::run(snippet_path),
Self::Prettypst => prettypst::run(snippet_path),
Self::Prisma => prisma::run_format(snippet_path),
Self::PuppetLint => puppet_lint::run(snippet_path),
Self::PursTidy => purs_tidy::run(snippet_path),
Expand Down Expand Up @@ -1427,6 +1433,7 @@ impl AsRef<str> for Tooling {
Self::Pint => "pint",
Self::Prettier => "prettier",
Self::PrettyPhp => "pretty-php",
Self::Prettypst => "prettypst",
Self::Prisma => "prisma",
Self::PuppetLint => "puppet-lint",
Self::PursTidy => "purs-tidy",
Expand Down
14 changes: 14 additions & 0 deletions mdsf/src/formatters/prettypst.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
use super::execute_command;
use crate::{error::MdsfError, runners::CommandType};

#[inline]
pub fn run(snippet_path: &std::path::Path) -> Result<(bool, Option<String>), MdsfError> {
let mut cmd = CommandType::Direct("prettypst").build();

cmd.arg(snippet_path);

execute_command(cmd, snippet_path)
}

#[cfg(test)]
mod test_prettypst {}
5 changes: 5 additions & 0 deletions schemas/v0.2.7/mdsf.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,11 @@
"type": "string",
"enum": ["pretty-php"]
},
{
"description": "https://github.com/antonWetzel/prettypst",
"type": "string",
"enum": ["prettypst"]
},
{
"description": "https://prisma.io/",
"type": "string",
Expand Down
Loading