Comparing version 8.16.0 to 8.16.1
@@ -28,3 +28,3 @@ import type { Issue } from '@cspell/cspell-types'; | ||
} | ||
export interface ReporterOptions extends Pick<LinterCliOptions, 'debug' | 'issues' | 'issuesSummaryReport' | 'legacy' | 'progress' | 'relative' | 'root' | 'showContext' | 'showPerfSummary' | 'showSuggestions' | 'silent' | 'summary' | 'verbose' | 'wordsOnly'> { | ||
export interface ReporterOptions extends Pick<LinterCliOptions, 'color' | 'debug' | 'issues' | 'issuesSummaryReport' | 'legacy' | 'progress' | 'relative' | 'root' | 'showContext' | 'showPerfSummary' | 'showSuggestions' | 'silent' | 'summary' | 'verbose' | 'wordsOnly'> { | ||
fileGlobs: string[]; | ||
@@ -31,0 +31,0 @@ } |
@@ -110,2 +110,4 @@ import assert from 'node:assert'; | ||
}; | ||
const noColor = options.color === false; | ||
const forceColor = options.color === true; | ||
const uniqueIssues = config?.unique || false; | ||
@@ -129,9 +131,10 @@ const defaultIssueTemplate = options.wordsOnly | ||
const console = config?.console || customConsole; | ||
const colorLevel = noColor ? 0 : forceColor ? 2 : console.stdoutChannel.getColorLevel(); | ||
const stdio = { | ||
...console.stdoutChannel, | ||
chalk: new Chalk({ level: console.stdoutChannel.getColorLevel() }), | ||
chalk: new Chalk({ level: colorLevel }), | ||
}; | ||
const stderr = { | ||
...console.stderrChannel, | ||
chalk: new Chalk({ level: console.stderrChannel.getColorLevel() }), | ||
chalk: new Chalk({ level: colorLevel }), | ||
}; | ||
@@ -138,0 +141,0 @@ const consoleError = (msg) => stderr.writeLine(msg); |
import { Option as CommanderOption } from 'commander'; | ||
import * as App from './application.mjs'; | ||
import { DEFAULT_CACHE_LOCATION } from './util/cache/index.js'; | ||
import { canUseColor } from './util/canUseColor.js'; | ||
import { CheckFailed } from './util/errors.js'; | ||
@@ -118,4 +119,4 @@ import { unindent } from './util/unindent.js'; | ||
.addOption(crOpt('--no-validate-directives', 'Do not validate in-document CSpell directives.').hideHelp()) | ||
.option('--no-color', 'Turn off color.') | ||
.option('--color', 'Force color.') | ||
.addOption(crOpt('--color', 'Force color.').default(undefined)) | ||
.addOption(crOpt('--no-color', 'Turn off color.').default(undefined)) | ||
.addOption(crOpt('--default-configuration', 'Load the default configuration and dictionaries.').hideHelp()) | ||
@@ -144,2 +145,3 @@ .addOption(crOpt('--no-default-configuration', 'Do not load the default configuration and dictionaries.')) | ||
} | ||
options.color ??= canUseColor(options.color); | ||
App.parseApplicationFeatureFlags(options.flag); | ||
@@ -146,0 +148,0 @@ const { mustFindFiles, fileList, files, file } = options; |
@@ -6,2 +6,3 @@ import { Option as CommanderOption } from 'commander'; | ||
import { emitTraceResults } from './emitters/traceEmitter.js'; | ||
import { canUseColor } from './util/canUseColor.js'; | ||
import { CheckFailed } from './util/errors.js'; | ||
@@ -27,4 +28,4 @@ export function commandTrace(prog) { | ||
.addOption(new CommanderOption('--only-found', 'Show only dictionaries that have the words.').conflicts('all')) | ||
.option('--no-color', 'Turn off color.') | ||
.option('--color', 'Force color') | ||
.addOption(new CommanderOption('--color', 'Force color.').default(undefined)) | ||
.addOption(new CommanderOption('--no-color', 'Turn off color.').default(undefined)) | ||
.addOption(new CommanderOption('--default-configuration', 'Load the default configuration and dictionaries.').hideHelp()) | ||
@@ -40,2 +41,3 @@ .addOption(new CommanderOption('--no-default-configuration', 'Do not load the default configuration and dictionaries.')) | ||
let prefix = ''; | ||
const useColor = canUseColor(options.color); | ||
for await (const results of App.trace(words, options)) { | ||
@@ -51,2 +53,3 @@ const byWord = groupBy(results, (r) => r.word); | ||
showWordFound: results.splits.length > 1, | ||
color: useColor, | ||
}); | ||
@@ -53,0 +56,0 @@ prefix = '\n'; |
@@ -16,2 +16,3 @@ import type { TraceResult } from '../application.mjs'; | ||
showWordFound?: boolean; | ||
color?: boolean | undefined; | ||
} | ||
@@ -18,0 +19,0 @@ export declare function emitTraceResults(word: string, found: boolean, results: TraceResult[], options: EmitTraceOptions): void; |
@@ -16,2 +16,8 @@ import * as iPath from 'node:path'; | ||
export function calcTraceResultsReport(word, found, results, options) { | ||
if (options.color === true) { | ||
chalk.level = 2; | ||
} | ||
else if (options.color === false) { | ||
chalk.level = 0; | ||
} | ||
const col = new Intl.Collator(); | ||
@@ -18,0 +24,0 @@ results.sort((a, b) => col.compare(a.dictName, b.dictName)); |
@@ -176,2 +176,8 @@ import { CSpellSettings } from '@cspell/cspell-types'; | ||
flag?: string[]; | ||
/** | ||
* Use color in the output. | ||
* `true` to force color, `false` to turn off color. | ||
* `undefined` to use color if the output is a TTY. | ||
*/ | ||
color?: boolean | undefined; | ||
} | ||
@@ -178,0 +184,0 @@ export interface LinterCliOptions extends LinterOptions { |
export { pkgDir } from './dirname.js'; | ||
export declare const name = "cspell"; | ||
export declare const version = "8.16.0"; | ||
export declare const version = "8.16.1"; | ||
export declare const engines: { | ||
@@ -5,0 +5,0 @@ node: string; |
// This file is generated by tools/patch-version.mjs | ||
export { pkgDir } from './dirname.js'; | ||
export const name = 'cspell'; | ||
export const version = '8.16.0'; | ||
export const version = '8.16.1'; | ||
export const engines = { node: '>=18' }; | ||
export const npmPackage = { name, version, engines }; | ||
//# sourceMappingURL=pkgInfo.js.map |
{ | ||
"name": "cspell", | ||
"version": "8.16.0", | ||
"version": "8.16.1", | ||
"description": "A Spelling Checker for Code!", | ||
@@ -84,15 +84,15 @@ "funding": "https://github.com/streetsidesoftware/cspell?sponsor=1", | ||
"dependencies": { | ||
"@cspell/cspell-json-reporter": "8.16.0", | ||
"@cspell/cspell-pipe": "8.16.0", | ||
"@cspell/cspell-types": "8.16.0", | ||
"@cspell/dynamic-import": "8.16.0", | ||
"@cspell/url": "8.16.0", | ||
"@cspell/cspell-json-reporter": "8.16.1", | ||
"@cspell/cspell-pipe": "8.16.1", | ||
"@cspell/cspell-types": "8.16.1", | ||
"@cspell/dynamic-import": "8.16.1", | ||
"@cspell/url": "8.16.1", | ||
"chalk": "^5.3.0", | ||
"chalk-template": "^1.1.0", | ||
"commander": "^12.1.0", | ||
"cspell-dictionary": "8.16.0", | ||
"cspell-gitignore": "8.16.0", | ||
"cspell-glob": "8.16.0", | ||
"cspell-io": "8.16.0", | ||
"cspell-lib": "8.16.0", | ||
"cspell-dictionary": "8.16.1", | ||
"cspell-gitignore": "8.16.1", | ||
"cspell-glob": "8.16.1", | ||
"cspell-io": "8.16.1", | ||
"cspell-lib": "8.16.1", | ||
"fast-json-stable-stringify": "^2.1.0", | ||
@@ -115,3 +115,3 @@ "file-entry-cache": "^9.1.0", | ||
}, | ||
"gitHead": "41cd50f9ba34033b6da32408855d7fc3b888c5e0" | ||
"gitHead": "773bb6e701ff0b7fbeb30e4621119bb4315415ad" | ||
} |
@@ -185,4 +185,4 @@ # cspell | ||
--validate-directives Validate in-document CSpell directives. | ||
--color Force color. | ||
--no-color Turn off color. | ||
--color Force color. | ||
--no-default-configuration Do not load the default configuration and | ||
@@ -277,4 +277,4 @@ dictionaries. | ||
--only-found Show only dictionaries that have the words. | ||
--color Force color. | ||
--no-color Turn off color. | ||
--color Force color | ||
--no-default-configuration Do not load the default configuration and | ||
@@ -281,0 +281,0 @@ dictionaries. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
203903
108
4202
+ Added@cspell/cspell-bundled-dicts@8.16.1(transitive)
+ Added@cspell/cspell-json-reporter@8.16.1(transitive)
+ Added@cspell/cspell-pipe@8.16.1(transitive)
+ Added@cspell/cspell-resolver@8.16.1(transitive)
+ Added@cspell/cspell-service-bus@8.16.1(transitive)
+ Added@cspell/cspell-types@8.16.1(transitive)
+ Added@cspell/dynamic-import@8.16.1(transitive)
+ Added@cspell/filetypes@8.16.1(transitive)
+ Added@cspell/strong-weak-map@8.16.1(transitive)
+ Added@cspell/url@8.16.1(transitive)
+ Addedcspell-config-lib@8.16.1(transitive)
+ Addedcspell-dictionary@8.16.1(transitive)
+ Addedcspell-gitignore@8.16.1(transitive)
+ Addedcspell-glob@8.16.1(transitive)
+ Addedcspell-grammar@8.16.1(transitive)
+ Addedcspell-io@8.16.1(transitive)
+ Addedcspell-lib@8.16.1(transitive)
+ Addedcspell-trie-lib@8.16.1(transitive)
- Removed@cspell/cspell-bundled-dicts@8.16.0(transitive)
- Removed@cspell/cspell-json-reporter@8.16.0(transitive)
- Removed@cspell/cspell-pipe@8.16.0(transitive)
- Removed@cspell/cspell-resolver@8.16.0(transitive)
- Removed@cspell/cspell-service-bus@8.16.0(transitive)
- Removed@cspell/cspell-types@8.16.0(transitive)
- Removed@cspell/dynamic-import@8.16.0(transitive)
- Removed@cspell/filetypes@8.16.0(transitive)
- Removed@cspell/strong-weak-map@8.16.0(transitive)
- Removed@cspell/url@8.16.0(transitive)
- Removedcspell-config-lib@8.16.0(transitive)
- Removedcspell-dictionary@8.16.0(transitive)
- Removedcspell-gitignore@8.16.0(transitive)
- Removedcspell-glob@8.16.0(transitive)
- Removedcspell-grammar@8.16.0(transitive)
- Removedcspell-io@8.16.0(transitive)
- Removedcspell-lib@8.16.0(transitive)
- Removedcspell-trie-lib@8.16.0(transitive)
Updated@cspell/cspell-pipe@8.16.1
Updated@cspell/cspell-types@8.16.1
Updated@cspell/url@8.16.1
Updatedcspell-dictionary@8.16.1
Updatedcspell-gitignore@8.16.1
Updatedcspell-glob@8.16.1
Updatedcspell-io@8.16.1
Updatedcspell-lib@8.16.1