diff --git a/README.md b/README.md index b194a45..26cb887 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Options: -k, --check Check if the given file(s) is already sorted [boolean] --indent, --id Indentation width (in spaces) [number] [default: 2] -e, --encoding Input encoding [choices: "ascii", "utf8", "utf16le"] [default: "utf8"] - -q, --quotingStyle Strings will be quoted using this quoting style [choices: "single", "double"] [default: "single"] + -q, --quoteStyle Strings will be quoted using this quote style [choices: "single", "double"] [default: "single"] -f, --forceQuotes Force quotes around all strings [boolean] -w, --lineWidth Wrap line width (-1 for unlimited width) [number] [default: 80] -h, --help Show help [boolean] diff --git a/test/test.js b/test/test.js index 8417d6f..d937283 100755 --- a/test/test.js +++ b/test/test.js @@ -45,8 +45,8 @@ test('CLI w/ arg', (t) => { proc.end() }) -test('CLI quoting style single', (t) => { - const proc = spawn(t, '../yaml-sort.js --input test-edges.yml --stdout --quotingStyle single', opts) +test('CLI quote style single', (t) => { + const proc = spawn(t, '../yaml-sort.js --input test-edges.yml --stdout --quoteStyle single', opts) proc.exitCode(0) proc.stdout.match('a: Lorem ipsum dolor sit amet, consectetur adipiscing elit...\n' + 'b:\n' + @@ -60,8 +60,8 @@ test('CLI quoting style single', (t) => { proc.end() }) -test('CLI quoting style double', (t) => { - const proc = spawn(t, '../yaml-sort.js --input test-edges.yml --stdout --quotingStyle double', opts) +test('CLI quote style double', (t) => { + const proc = spawn(t, '../yaml-sort.js --input test-edges.yml --stdout --quoteStyle double', opts) proc.exitCode(0) proc.stdout.match('a: Lorem ipsum dolor sit amet, consectetur adipiscing elit...\n' + 'b:\n' + @@ -248,7 +248,7 @@ test('CLI --check --stdout FAIL', (t) => { }) test('CLI multiple YAML documents with single quotes', (t) => { - const proc = spawn(t, '../yaml-sort.js --input test-multiple.yml --stdout --quotingStyle single --forceQuotes', opts) + const proc = spawn(t, '../yaml-sort.js --input test-multiple.yml --stdout --quoteStyle single --forceQuotes', opts) proc.exitCode(0) proc.stdout.match( '---\n' + @@ -266,7 +266,7 @@ test('CLI multiple YAML documents with single quotes', (t) => { }) test('CLI multiple YAML documents with double quotes', (t) => { - const proc = spawn(t, '../yaml-sort.js --input test-multiple.yml --stdout --quotingStyle double --forceQuotes', opts) + const proc = spawn(t, '../yaml-sort.js --input test-multiple.yml --stdout --quoteStyle double --forceQuotes', opts) proc.exitCode(0) proc.stdout.match( '---\n' + @@ -284,7 +284,7 @@ test('CLI multiple YAML documents with double quotes', (t) => { }) test('CLI multiple YAML documents --check FAIL', (t) => { - const proc = spawn(t, '../yaml-sort.js --input test-multiple-unsorted.yml --check --quotingStyle single --forceQuotes', opts) + const proc = spawn(t, '../yaml-sort.js --input test-multiple-unsorted.yml --check --quoteStyle single --forceQuotes', opts) proc.exitCode(1) proc.stdout.match('') proc.stderr.match('\'test-multiple-unsorted.yml\' is not sorted and/or formatted (indent, line width).\n') diff --git a/yaml-sort.js b/yaml-sort.js index 88fc332..fbec7b2 100755 --- a/yaml-sort.js +++ b/yaml-sort.js @@ -59,10 +59,10 @@ const argv = yargs(hideBin(process.argv)) describe: 'Input encoding', choices: ['ascii', 'utf8', 'utf16le'] }) - .option('quotingStyle', { + .option('quoteStyle', { alias: 'q', default: 'single', - describe: 'Strings will be quoted using this quoting style', + describe: 'Strings will be quoted using this quote style', choices: ['single', 'double'] }) .option('forceQuotes', { @@ -106,7 +106,7 @@ argv.input.forEach((file) => { sortKeys: true, indent: argv.indent, lineWidth: argv.lineWidth, - quoteStyle: argv.quotingStyle, + quoteStyle: argv.quoteStyle, forceQuotes: argv.forceQuotes }))