Skip to content

Commit

Permalink
fix: support --no-gitignore option (#1833)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason3S committed Oct 5, 2021
1 parent b9df331 commit 0b89fed
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 5 deletions.
26 changes: 26 additions & 0 deletions packages/cspell/src/__snapshots__/app.test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,5 +1,30 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Validate cli app --help Expect Error: outputHelp 1`] = `
Array [
"Usage: cspell [options] [command]",
"",
"Spelling Checker for Code",
"",
"Options:",
" -V, --version output the version number",
" -h, --help display help for command",
"",
"Commands:",
" lint [options] [files...] Check spelling",
" trace [options] <words...> Trace words",
" Search for words in the configuration and dictionaries.",
" check [options] <files...> Spell check file(s) and display the result. The",
" full file is displayed in color.",
" link Link dictionaries any other settings to the",
" cspell global config.",
" help [command] display help for command",
"",
]
`;

exports[`Validate cli app --help Expect Error: outputHelp 2`] = `""`;

exports[`Validate cli app LICENSE Expect Error: undefined 1`] = `Array []`;

exports[`Validate cli app LICENSE Expect Error: undefined 2`] = `
Expand Down Expand Up @@ -303,6 +328,7 @@ Array [
" \\".cspellcache\\")",
" --gitignore Ignore files matching glob patterns found in",
" .gitignore files.",
" --no-gitignore Do NOT use .gitignore files.",
" --gitignore-root <path> Prevent searching for .gitignore files past",
" root.",
" --no-color Turn off color.",
Expand Down
1 change: 1 addition & 0 deletions packages/cspell/src/app.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ describe('Validate cli', () => {
msg | testArgs | errorCheck | eError | eLog | eInfo
${'with errors and excludes'} | ${['-r', 'samples', '*', '-e', 'Dutch.txt', '-c', 'samples/.cspell.json']} | ${app.CheckFailed} | ${true} | ${true} | ${false}
${'no-args'} | ${[]} | ${'outputHelp'} | ${false} | ${false} | ${false}
${'--help'} | ${['--help']} | ${'outputHelp'} | ${false} | ${false} | ${false}
${'current_file'} | ${[__filename]} | ${undefined} | ${true} | ${false} | ${false}
${'with spelling errors Dutch.txt'} | ${[pathSamples('Dutch.txt')]} | ${app.CheckFailed} | ${true} | ${true} | ${false}
${'with spelling errors Dutch.txt words only'} | ${[pathSamples('Dutch.txt'), '--wordsOnly']} | ${app.CheckFailed} | ${true} | ${true} | ${false}
Expand Down
6 changes: 1 addition & 5 deletions packages/cspell/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,7 @@ export async function run(program?: commander.Command, argv?: string[]): Promise

prog.exitOverride();

prog.version(npmPackage.version)
.description('Spelling Checker for Code')
.name('cspell')
.option('--no-color', 'Turn off color.')
.option('--color', 'Force color');
prog.version(npmPackage.version).description('Spelling Checker for Code').name('cspell');

commandLint(prog);
commandTrace(prog);
Expand Down
1 change: 1 addition & 0 deletions packages/cspell/src/commandLint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ export function commandLint(prog: Command): Command {
)
.option('--cache-location <path>', `Path to the cache file or directory`, DEFAULT_CACHE_LOCATION)
.option('--gitignore', 'Ignore files matching glob patterns found in .gitignore files.')
.option('--no-gitignore', 'Do NOT use .gitignore files.')
.option('--gitignore-root <path>', 'Prevent searching for .gitignore files past root.', collect)
.option('--no-color', 'Turn off color.')
.option('--color', 'Force color')
Expand Down

0 comments on commit 0b89fed

Please sign in to comment.