{"id":13772114,"url":"https://github.com/pest-parser/pest-fmt","last_synced_at":"2025-07-26T19:31:46.913Z","repository":{"id":66091072,"uuid":"201250465","full_name":"pest-parser/pest-fmt","owner":"pest-parser","description":null,"archived":false,"fork":false,"pushed_at":"2024-04-08T01:22:57.000Z","size":120,"stargazers_count":25,"open_issues_count":4,"forks_count":5,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-10-29T14:22:29.462Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pest-parser.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2019-08-08T12:08:49.000Z","updated_at":"2024-07-29T00:29:25.000Z","dependencies_parsed_at":"2024-01-12T06:29:06.431Z","dependency_job_id":"c5f3e6e0-cc21-4067-947e-dd60fd78edd2","html_url":"https://github.com/pest-parser/pest-fmt","commit_stats":{"total_commits":40,"total_committers":5,"mean_commits":8.0,"dds":0.5,"last_synced_commit":"e9cb1f6f064264e563ddc0ab6b15aea55e1d4222"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pest-parser%2Fpest-fmt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pest-parser%2Fpest-fmt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pest-parser%2Fpest-fmt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pest-parser%2Fpest-fmt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pest-parser","download_url":"https://codeload.github.com/pest-parser/pest-fmt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227372194,"owners_count":17770955,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T17:01:00.167Z","updated_at":"2024-12-02T10:16:11.836Z","avatar_url":"https://github.com/pest-parser.png","language":"Rust","funding_links":[],"categories":["Tooling"],"sub_categories":["IDE Support"],"readme":"# Pest Formatter\n\n[![Test](https://github.com/pest-parser/pest-fmt/actions/workflows/test.yml/badge.svg)](https://github.com/pest-parser/pest-fmt/actions/workflows/test.yml) [![Crate](https://img.shields.io/crates/v/pest_fmt?color=1t\u0026label=Crate)](https://crates.io/crates/pest_fmt)\n\nPest Formatter is a tool to format [Pest](https://pest.rs) grammar files.\n\n## Installation\n\n```bash\ncargo install pest_fmt\n```\n\n## Usage\n\nThen use the `pestfmt` command to format your `.pest` files.\n\n```bash\n$ pestfmt -h\nA formatter tool for pest\n\nUsage: pestfmt [OPTIONS] [FILE]...\n\nArguments:\n  [FILE]...  The file or path to format [default: .]\n\nOptions:\n  -s, --stdin\n  -h, --help     Print help\n  -V, --version  Print version\n```\n\n### Format pest files\n\n```bash\n$ pestfmt .\n```\n\nIt will find all `.pest` files in the current directory and format and overwrite them.\n\nOutput:\n\n```bash\nPest Formatter\n-------------------------------------\n2 files formatted.\n```\n\n### Format from stdin\n\nYou can use `--stdin` option to format Pest source code from stdin, it will read from stdin and write to stdout.\n\n```bash\ncat file.pest | pestfmt --stdin\n```\n\n### Usage as a library\n\nAdd `pest_fmt` into your `Cargo.toml`:\n\n```bash\n$ cargo add pest_fmt\n```\n\nThen use the `Formatter` struct to format pest grammar.\n\n```rs\nuse pest_fmt::Formatter;\n\nlet mut fmt = Formatter::new(\"a={ASCII_DIGIT}\");\nlet out = fmt.format().unwrap();\nprintln!(\"{out}\");\n// a = { ASCII_DIGIT }\n```\n\n## Development Tool Integration\n\n### VS Code\n\nhttps://github.com/pest-parser/pest-ide-tools\n\n## Benchmark\n\nBased on MacBook Pro (Apple M1 2020)\n\n```\nformat (json.pest)                time:   [89.403 µs 89.632 µs 89.878 µs]\nformat (grammar.pest)             time:   [1.6018 ms 1.6054 ms 1.6105 ms]\n```\n\n## License\n\nMozilla Public License 2.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpest-parser%2Fpest-fmt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpest-parser%2Fpest-fmt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpest-parser%2Fpest-fmt/lists"}