diff --git a/packages/cspell/src/__snapshots__/app.test.ts.snap b/packages/cspell/src/__snapshots__/app.test.ts.snap index 815238537eee..70eac7676949 100644 --- a/packages/cspell/src/__snapshots__/app.test.ts.snap +++ b/packages/cspell/src/__snapshots__/app.test.ts.snap @@ -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] Trace words", + " Search for words in the configuration and dictionaries.", + " check [options] 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`] = ` @@ -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 Prevent searching for .gitignore files past", " root.", " --no-color Turn off color.", diff --git a/packages/cspell/src/app.test.ts b/packages/cspell/src/app.test.ts index f1e5d08ae604..7bccc57e1126 100644 --- a/packages/cspell/src/app.test.ts +++ b/packages/cspell/src/app.test.ts @@ -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} diff --git a/packages/cspell/src/app.ts b/packages/cspell/src/app.ts index 57aefb357f76..37dc167c3ddc 100644 --- a/packages/cspell/src/app.ts +++ b/packages/cspell/src/app.ts @@ -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); diff --git a/packages/cspell/src/commandLint.ts b/packages/cspell/src/commandLint.ts index dd457565eb08..7357d9c9fa73 100644 --- a/packages/cspell/src/commandLint.ts +++ b/packages/cspell/src/commandLint.ts @@ -90,6 +90,7 @@ export function commandLint(prog: Command): Command { ) .option('--cache-location ', `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 ', 'Prevent searching for .gitignore files past root.', collect) .option('--no-color', 'Turn off color.') .option('--color', 'Force color')