-
Notifications
You must be signed in to change notification settings - Fork 47
feat(cli): Add topiary check-grammar subcommand
#1094
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
Conversation
topiary check commandtopiary check command
topiary check commandtopiary check-grammar subcommand
Xophmeister
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As always, this looks great, @mkatychev 🙏
I've left a few very minor suggestions, but this is good to go.
| match self { | ||
| Self::Stdin => write!(f, "standard input"), | ||
| Self::Disk(path, _) => write!(f, "{}", path.to_string_lossy()), | ||
| Self::Disk(path, _) => write!(f, "{}", path.display()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TIL That path.display() will do the lossy UTF-8 conversion... but if PathBuf implements Display, then surely one can write write!(f, "{path}")?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://doc.rust-lang.org/std/path/struct.PathBuf.html#impl-Debug-for-PathBuf I don't think it implements display, LMK if you see it though!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, you're right: It's because of there's a Deref<Target=Path> implementation, which is where the .display comes from 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've moved most of the logging over to path.display()
| // meant to be used in scenarios where multiple inputs are possible | ||
| pub(crate) async fn process_inputs<F>(inputs: Inputs<'_>, process_fn: F) -> CLIResult<()> | ||
| where | ||
| F: Fn(InputFile, Arc<Language>) -> CLIResult<()> + Send + Sync + 'static, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice 👍
Add
topiary check-grammarsubcommandReferences #977
Description
The
topiary check-grammar(withtopiary checkalias) subcommandchecks that one or more inputs are parseable to a tree-sitter grammar,
returning all locations where a parsing error occurred:
Checklist
Checklist before merging, wherever relevant:
CHANGELOG.mdupdatedREADME.md, etc.) up-to-date