Is it possible to input a file and get the transformed contents out on stdout #432
Closed
kaleidawave
started this conversation in
General
Replies: 1 comment 2 replies
-
The
|
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi! Have been playing with gritql a bit and made a query that finds a Rust enum and produces a match statement. (In a sense imitating the rust-analyser 'fill match branches' but on the command line without the LSP).
The query is
I think I can save this as a reusable pattern inside the
.grit
directory. The part I am not quite sure exists is whether a command exists in the grit CLI that I can run that takes a file and produces the match result to stdout. I understand the lintinggrit check
and the general file mutationsgrit apply
(akin to codemod), what I want it something that just pipes a string in and results matched transformed results out. Something likegrit find my_file.rs --pattern 'enum_to_match(name="MyEnum")' --stdout
?Thanks 🙏
Beta Was this translation helpful? Give feedback.
All reactions