-
Notifications
You must be signed in to change notification settings - Fork 623
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
prettier: support read code from stdin and output to stdout #498
Conversation
/cc @ry it's ready for review. |
I think we should document |
Can you help me see if the documentation for |
The help message looks good to me. |
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.
LGTM
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.
LGTM
closes #457
Try it out
run in Linux/MacOS
curl https://raw.githubusercontent.com/denoland/deno_std/master/prettier/testdata/0.ts | deno --reload https://github.com/axetroy/deno_std/raw/prettier_stdin/prettier/main.ts
run in Windows
(iwr https://raw.githubusercontent.com/denoland/deno_std/master/prettier/testdata/0.ts).Content | deno --reload https://github.com/axetroy/deno_std/raw/prettier_stdin/prettier/main.ts
Design goals:
What it changes?
--stdin
flag to read the code from stdin. only use in the test.--stdin-parser
to set parser. tell prettier what code it is fromstdin
. default:typescript
stderr
instead ofstdout
Why I need this feature
I am writing a formatter for justjavac.vscode-deno.
currently,
deno fmt
is a file-based formatting tool.But in the IDE/editor not based on files, it may be a temporary string (if the file is modified, but the file is not maintained).
So this PR is for better-integrated development tools.