diff --git a/bin/prettier b/bin/prettier index 55510ada4..3d21cc6fd 100755 --- a/bin/prettier +++ b/bin/prettier @@ -16,13 +16,15 @@ const write = argv['write']; if(!filename || !filename.match(/\S/)) { console.log( - "Usage: prettier \n\n" + + "Usage: prettier [opts] [filename]\n\n" + "Available options:\n" + - " --write Edit the file in-place (beware!)\n" + - " --flow-parser Use the flow parser instead of babylon\n" + - " --single-quote Use single quotes instead of double\n" + - " --trailing-comma Print trailing commas wherever possible\n" + - " --bracket-spacing Put spaces between brackets. Defaults to true, set false to turn off" + " --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" + + " --tab-width Specify the number of spaces per indentation-level. Defaults to 2.\n" + + " --flow-parser Use the flow parser instead of babylon\n" + + " --single-quote Use single quotes instead of double\n" + + " --trailing-comma Print trailing commas wherever possible\n" + + " --bracket-spacing Put spaces between brackets. Defaults to true, set false to turn off" ); process.exit(1); } diff --git a/src/options.js b/src/options.js index 53b2fc4da..79a689134 100644 --- a/src/options.js +++ b/src/options.js @@ -1,32 +1,17 @@ var defaults = { - // Number of spaces the pretty-printer should use per tab for - // indentation. If you do not pass this option explicitly, it will be - // (quite reliably!) inferred from the original code. + // Number of spaces the pretty-printer should use per tab tabWidth: 2, - // Fit code within this line limit. + // Fit code within this line limit printWidth: 80, // If true, will use single instead of double quotes singleQuote: false, - // Controls the printing of trailing commas in object literals, - // array expressions and function parameters. - // - // This option could either be: - // * Boolean - enable/disable in all contexts (objects, arrays and function params). - // * Object - enable/disable per context. - // - // Example: - // trailingComma: { - // objects: true, - // arrays: true, - // parameters: false, - // } + // Controls the printing of trailing commas wherever possible trailingComma: false, // Controls the printing of spaces inside array and objects - // See: http://eslint.org/docs/rules/array-bracket-spacing bracketSpacing: true };