-
Notifications
You must be signed in to change notification settings - Fork 85
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
grit format
command
#574
Comments
/bounty $200 |
💎 $200 bounty • GritSteps to solve:
Thank you for contributing to getgrit/gritql! Add a bounty • Share on socials
|
Hello |
I do not assign issues to first-time contributors. You're welcome to attempt it. |
/attempt #574 Options |
I ran into an issue while implementing this. Is there a way to list only the grit patterns in the current directory? It looks like |
Look at how |
Thanks. I updated the code to follow a similar pattern to what's in I've made progress on this but ran into a blocker, and I’d appreciate your input. The formatter is working locally by depending on the However, the issue is that the formatter doesn’t actually support the files we want to format. Specifically, it doesn’t support markdown patterns and For instance, running the Am I missing something here? |
This is expected. You need to extract the gritql from the markdown file and format the extracted gritql then write it back in. We already have logic (in
What fails? We should patch that upstream. |
This seems like a special case we could address in a follow-up PR. I have the main functionality set up locally, including the Do you think I should open a PR for this?
It’s a bit inconsistent at the moment—it works for some ---- format_write stdout ----
thread 'main' panicked at /Users/tareknasser/.cargo/git/checkouts/biome-d49ce8898b420a50/8a90b89/crates/biome_parser/src/diagnostic.rs:350:14:
Expected token to be a punctuation or keyword. |
It's not a special case. I called it out as core functionality that is intrinsic to this ticket.
You can, but the bounty will not be awarded until the issue is completed. You must handle .md and .yaml files, as stated in the spec.
That's a biome issue, so you can ignore it. It's out of scope for this issue. |
/attempt #574 Options |
Related to getgrit#574 Add `grit format` command to the Grit CLI. * Implement the `grit format` command in `crates/cli/src/commands/format.rs` using the Biome crate for formatting. * Add logic to look for all grit patterns in the current directory, including `.yaml`, `.grit` files, and markdown patterns. * Implement the `--write` flag to write the re-formatted patterns back if provided. * Extract gritql from markdown files and format the extracted gritql. * Update `crates/cli/src/commands/mod.rs` to include the `format` module and the `Format` variant in the `Commands` enum. * Add a CLI test case for the `grit format` command in `crates/cli_bin/tests/format.rs`.
Now that biome has added support for Grit as a formattable language we should add a
grit format
command to the Grit CLI. We can (hopefully) depend on the Biome crate for this.grit format
should:grit list
), includinggrit.yaml
,*.grit
files, and markdown patterns--write
flag is provided, write the re-formatted patterns back. Otherwise just display the diff / changesUse https://github.com/getgrit/stdlib for a repo to test on, but add at least one CLI test case in https://github.com/getgrit/gritql/tree/main/crates/cli_bin/tests
The text was updated successfully, but these errors were encountered: