From f1db144341dad2de0c7a6b6896c3a2ef094c23cd Mon Sep 17 00:00:00 2001 From: Damien Lebrun Date: Wed, 11 Jan 2017 16:02:30 +0000 Subject: [PATCH] docs: add globbing example Although prettier lacks options to filter project files to format by itself, most shells allow to submit multiple files with a filename expansion. Add an example using bash. --- README.md | 12 +++++++++--- bin/prettier.js | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 8ee5e736a..c20786860 100644 --- a/README.md +++ b/README.md @@ -97,13 +97,19 @@ Run prettier through the CLI with this script. Run it without any arguments to see the options. To format a file in-place, use `--write`. While this is in beta you -should probably commit your code before doing that. In the future we -will have better support for formatting whole projects. +should probably commit your code before doing that. ```js -prettier +prettier [opts] [filename ...] ``` +For example, you could format your source using bash filename expansion: +```bash +prettier --write src/**/*.js bin/*.js +``` + +In the future we will have better support for formatting whole projects. + ### API The API is a single function exported as `format`. The options diff --git a/bin/prettier.js b/bin/prettier.js index d2c2e935c..31c8bef5d 100755 --- a/bin/prettier.js +++ b/bin/prettier.js @@ -17,7 +17,7 @@ const write = argv["write"]; if (!filenames.length) { console.log( - "Usage: prettier [opts] [filename]\n\n" + + "Usage: prettier [opts] [filename ...]\n\n" + "Available options:\n" + " --write Edit the file in-place (beware!)\n" + " --print-width Specify the length of line that the printer will wrap on. Defaults to 80.\n" +