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: Upgrade Commander to v13 #6764

Merged
merged 3 commits into from
Jan 8, 2025
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
2 changes: 1 addition & 1 deletion integration-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"@octokit/rest": "^21.0.2",
"ansi-escapes": "^7.0.0",
"chalk": "^5.4.1",
"commander": "^12.1.0",
"commander": "^13.0.0",
"csv-parse": "^5.6.0",
"csv-stringify": "^6.5.2",
"jest-diff": "^29.7.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/cspell-tools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"homepage": "https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell-tools#readme",
"dependencies": {
"@cspell/cspell-pipe": "workspace:*",
"commander": "^12.1.0",
"commander": "^13.0.0",
"cosmiconfig": "9.0.0",
"cspell-trie-lib": "workspace:*",
"glob": "^10.4.5",
Expand Down
2 changes: 1 addition & 1 deletion packages/cspell-trie/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
},
"homepage": "https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell-trie#readme",
"dependencies": {
"commander": "^12.1.0",
"commander": "^13.0.0",
"cspell-trie-lib": "workspace:*",
"gensequence": "^7.0.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/cspell/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
"@cspell/url": "workspace:*",
"chalk": "^5.4.1",
"chalk-template": "^1.1.0",
"commander": "^12.1.0",
"commander": "^13.0.0",
"cspell-dictionary": "workspace:*",
"cspell-gitignore": "workspace:*",
"cspell-glob": "workspace:*",
Expand Down
35 changes: 15 additions & 20 deletions packages/cspell/src/app/__snapshots__/app.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,7 @@ exports[`Validate cli > app 'check help' Expect Error: 'outputHelp' 1`] = `
[
"Usage: cspell check [options] <files...>",
"",
"Spell check file(s) and display the result. The full file is displayed in",
"color.",
"Spell check file(s) and display the result. The full file is displayed in color.",
"",
"Options:",
" -c, --config <cspell.json> Configuration file to use. By default cspell",
Expand Down Expand Up @@ -628,8 +627,8 @@ exports[`Validate cli > app 'lint --help --issue-template' Expect Error: 'output
" -u, --unique Only output the first instance of a word not",
" found in the dictionaries.",
" -e, --exclude <glob> Exclude files matching the glob pattern. This",
" option can be used multiple times to add",
" multiple globs.",
" option can be used multiple times to add multiple",
" globs.",
" --file-list <path or stdin> Specify a list of files to be spell checked. The",
" list is filtered against the glob file patterns.",
" Note: the format is 1 file path per line.",
Expand Down Expand Up @@ -662,8 +661,7 @@ exports[`Validate cli > app 'lint --help --issue-template' Expect Error: 'output
" --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.",
" --gitignore-root <path> Prevent searching for .gitignore files past root.",
" --validate-directives Validate in-document CSpell directives.",
" --color Force color.",
" --no-color Turn off color.",
Expand Down Expand Up @@ -772,8 +770,8 @@ exports[`Validate cli > app 'lint --help --verbose' Expect Error: 'outputHelp' 1
" -u, --unique Only output the first instance of a word not",
" found in the dictionaries.",
" -e, --exclude <glob> Exclude files matching the glob pattern. This",
" option can be used multiple times to add",
" multiple globs.",
" option can be used multiple times to add multiple",
" globs.",
" --file-list <path or stdin> Specify a list of files to be spell checked. The",
" list is filtered against the glob file patterns.",
" Note: the format is 1 file path per line.",
Expand Down Expand Up @@ -806,8 +804,7 @@ exports[`Validate cli > app 'lint --help --verbose' Expect Error: 'outputHelp' 1
" --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.",
" --gitignore-root <path> Prevent searching for .gitignore files past root.",
" --validate-directives Validate in-document CSpell directives.",
" --color Force color.",
" --no-color Turn off color.",
Expand Down Expand Up @@ -909,8 +906,8 @@ exports[`Validate cli > app 'lint --help' Expect Error: 'outputHelp' 1`] = `
" -u, --unique Only output the first instance of a word not",
" found in the dictionaries.",
" -e, --exclude <glob> Exclude files matching the glob pattern. This",
" option can be used multiple times to add",
" multiple globs.",
" option can be used multiple times to add multiple",
" globs.",
" --file-list <path or stdin> Specify a list of files to be spell checked. The",
" list is filtered against the glob file patterns.",
" Note: the format is 1 file path per line.",
Expand Down Expand Up @@ -943,8 +940,7 @@ exports[`Validate cli > app 'lint --help' Expect Error: 'outputHelp' 1`] = `
" --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.",
" --gitignore-root <path> Prevent searching for .gitignore files past root.",
" --validate-directives Validate in-document CSpell directives.",
" --color Force color.",
" --no-color Turn off color.",
Expand Down Expand Up @@ -1044,8 +1040,8 @@ exports[`Validate cli > app 'no-args' Expect Error: 'outputHelp' 1`] = `
" -u, --unique Only output the first instance of a word not",
" found in the dictionaries.",
" -e, --exclude <glob> Exclude files matching the glob pattern. This",
" option can be used multiple times to add",
" multiple globs.",
" option can be used multiple times to add multiple",
" globs.",
" --file-list <path or stdin> Specify a list of files to be spell checked. The",
" list is filtered against the glob file patterns.",
" Note: the format is 1 file path per line.",
Expand Down Expand Up @@ -1078,8 +1074,7 @@ exports[`Validate cli > app 'no-args' Expect Error: 'outputHelp' 1`] = `
" --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.",
" --gitignore-root <path> Prevent searching for .gitignore files past root.",
" --validate-directives Validate in-document CSpell directives.",
" --color Force color.",
" --no-color Turn off color.",
Expand Down Expand Up @@ -1660,8 +1655,8 @@ exports[`Validate cli > app 'trace help' Expect Error: 'outputHelp' 1`] = `
"Options:",
" -c, --config <cspell.json> Configuration file to use. By default cspell",
" looks for cspell.json in the current directory.",
" --locale <locale> Set language locales. i.e. "en,fr" for English",
" and French, or "en-GB" for British English.",
" --locale <locale> Set language locales. i.e. "en,fr" for English and",
" French, or "en-GB" for British English.",
" --language-id <language> Use programming language. i.e. "php" or "scala".",
" --allow-compound-words Turn on allowCompoundWords",
" --no-allow-compound-words Turn off allowCompoundWords",
Expand Down
11 changes: 3 additions & 8 deletions packages/cspell/src/app/commandLint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,20 +244,15 @@ function augmentCommandHelp(context: AddHelpTextContext) {
const showHidden = !!opts.verbose;
const hiddenHelp: string[] = [];
const help = command.createHelp();
help.helpWidth = process.stdout.columns || 80;
const hiddenOptions = command.options.filter((opt) => opt.hidden && showHidden);
const flagColWidth = Math.max(...command.options.map((opt) => opt.flags.length), 0);
const indent = flagColWidth + 4;
// const indent = flagColWidth + 4;
for (const options of hiddenOptions) {
if (!hiddenHelp.length) {
hiddenHelp.push('\nHidden Options:');
}
hiddenHelp.push(
help.wrap(
` ${options.flags.padEnd(flagColWidth)} ${options.description}`,
process.stdout.columns || 80,
indent,
),
);
hiddenHelp.push(help.formatItem(options.flags, flagColWidth, options.description, help));
}
output.push(...hiddenHelp, advanced);
return helpIssueTemplate(opts) + output.join('\n');
Expand Down
2 changes: 1 addition & 1 deletion packages/hunspell-reader/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"dependencies": {
"@cspell/cspell-pipe": "workspace:^",
"@cspell/cspell-types": "workspace:^",
"commander": "^12.1.0",
"commander": "^13.0.0",
"gensequence": "^7.0.0",
"html-entities": "^2.5.2",
"iconv-lite": "^0.6.3"
Expand Down
32 changes: 19 additions & 13 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading