Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
dzencot committed Jul 3, 2024
1 parent 6befaaa commit 50af113
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ check:
hexlet/languagetool-cli \
node ./bin/run.js check /content/**/*.md

run-fix:
fix:
docker run --rm \
-v ./fixtures:/content \
-v ./bin:/LanguageTool-6.4/bin \
-v ./src:/LanguageTool-6.4/src \
hexlet/languagetool-cli \
node ./bin/run.js fix /content/**/*.md

run-ignore:
ignore:
docker run --rm \
-v ./fixtures:/content \
-v ./bin:/LanguageTool-6.4/bin \
Expand Down
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,20 @@ Help:
```bash
docker run --rm -v ./fixtures:/content hexlet/languagetool-cli node ./bin/run.js check -h

Usage: run check [options] <dirPath>
Usage: run check [options] [dir_path]

Fix errors with overwriting files

Arguments:
dir_path path to files (default: "/content")

Options:
-r, --rules "rule1, rule2, ..." languagetools rules
-l, --language <Ru-ru> A language code like en-US, de-DE, fr, or
auto to guess the language automatically
(default: "auto")
-i, --ignore <file_path> Path to file with ignore contexts (default:
"/content/ignore")
-h, --help display help for command
```

Expand Down
7 changes: 3 additions & 4 deletions bin/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ program
.argument('[dir_path]', 'path to files', '/content')
.option('-r, --rules "rule1, rule2, ..."', 'languagetools rules', '')
.option('-l, --language <Ru-ru>', 'A language code like en-US, de-DE, fr, or auto to guess the language automatically', 'auto')
.option('-i, --ignore <file_path>', 'Path to file with ignore rules', '/content/ignore')
.option('-i, --ignore <file_path>', 'Path to file with ignore contexts', '/content/ignore')
.action((dirPath, options) => {
exec(serverStartCommand, () => setTimeout(async () => {
const rules = options.rules.split(',').map((item) => item.trim()).filter((item) => item);
Expand All @@ -24,8 +24,8 @@ program

const errors = await getErrors(dirPath, language, rules);
const filtered = filterIgnoredErrors(errors, ignorePath);
if (filtered) {
const formattedErrors = formatErrors(errors);
if (filtered.length > 0) {
const formattedErrors = formatErrors(filtered);
console.log(formattedErrors.join('\n------------------------\n'));
process.exit(1);
}
Expand All @@ -38,7 +38,6 @@ program
.argument('[dir_path]', 'path to files', '/content')
.option('-r, --rules "rule1, rule2, ..."', 'languagetools rules', '')
.option('-l, --language <Ru-ru>', 'A language code like en-US, de-DE, fr, or auto to guess the language automatically', 'auto')
.option('-i, --ignore <file_path>', 'Path to file with ignore rules', '/content/ignore')
.action((dirPath = '/content', options) => {
exec(serverStartCommand, () => setTimeout(async () => {
const rules = options.rules.split(',').map((item) => item.trim()).filter((item) => item);
Expand Down

0 comments on commit 50af113

Please sign in to comment.