UNPKG

2.97 kBJavaScriptView Raw
1'use strict';
2
3const program = require('commander');
4const utils = require('./utils');
5
6function splitTrim(value, separator) {
7 return value.split(separator).map(el => el.trim());
8}
9
10function splitByCommas(value) {
11 return splitTrim(value, ',');
12}
13
14module.exports = {
15 init(params) {
16 program
17 .version(require('../package.json').version)
18 .usage('[options] <file-or-directory-or-link...>')
19 .option('-l, --lang <value>', 'languages: en, ru or uk. Default: "en,ru"')
20 .option('-f, --format <value>', 'formats: plain, html, markdown or auto. Default: auto')
21 .option('-c, --config <path>', 'configuration file path')
22 .option('-e, --file-extensions <value>', 'set file extensions to search for files in a folder. Example: ".md,.html"', splitByCommas, null)
23 .option('--init', 'save default config ".yaspellerrc" in current directory')
24 .option('--dictionary <file>', 'json file for own dictionary', value => splitTrim(value, ':'), [])
25 .option('--no-colors', 'clean output without colors')
26 .option('--report <type>', 'generate a report: console, text, html or json. Default: console', splitByCommas, null)
27 .option('--ignore-tags <tags>', 'ignore tags. Default: "' +
28 params.defaultIgnoreTags +
29 '"', splitByCommas, null)
30 .option('--ignore-text <regexp>', 'ignore text using RegExp')
31 .option('--stdin', 'process files on <STDIN>. Default: false')
32 .option('--stdin-filename <file>', 'specify filename to process STDIN as')
33 .option('--max-requests <number>', 'max count of requests at a time. Default: 2', parseInt, 0)
34 .option('--only-errors', 'output only errors')
35 .option('--check-yo', 'checking the letter Ё (Yo) in words.')
36 .option('--debug', 'debug mode');
37
38 this.apiOptions.forEach(function(el) {
39 program.option('--' + utils.kebabCase(el[0]), el[1]);
40 });
41 },
42 apiOptions: [
43 ['byWords', 'do not use a dictionary environment (context) during the scan. This is useful in cases where the service is transmitted to the input of a list of individual words'],
44 ['findRepeatWords', 'highlight repetitions of words, consecutive. For example, "I flew to to to Cyprus"'],
45 ['flagLatin', 'celebrate words, written in Latin, as erroneous'],
46 ['ignoreCapitalization', 'ignore the incorrect use of UPPERCASE / lowercase letters, for example, in the word "moscow"'],
47 ['ignoreDigits', 'ignore words with numbers, such as "avp17h4534"'],
48 ['ignoreLatin', 'ignore words, written in Latin, for example, "madrid"'],
49 ['ignoreRomanNumerals', 'ignore Roman numerals ("I, II, III, ...")'],
50 ['ignoreUrls', 'ignore Internet addresses, email addresses and filenames'],
51 ['ignoreUppercase', 'ignore words written in capital letters']
52 ]
53};