Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: support --no-gitignore option #1833

Merged
merged 1 commit into from
Oct 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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