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

Update command line parameters for consistency #1103

Merged
merged 1 commit into from
Dec 11, 2024
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
30 changes: 16 additions & 14 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"chalk": "^2.4.2",
"cheerio": "^1.0.0-rc.9",
"cockatiel": "^3.1.2",
"commander": "^6.2.1",
"commander": "^12.1.0",
"form-data": "^4.0.0",
"glob": "^11.0.0",
"hosted-git-info": "^4.0.2",
Expand Down
12 changes: 8 additions & 4 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import program from 'commander';
import { Command, Option } from 'commander';
import leven from 'leven';
import { packageCommand, ls, Targets, generateManifest, verifySignature } from './package';
import { publish, unpublish } from './publish';
Expand Down Expand Up @@ -56,6 +56,8 @@ function main(task: Promise<any>): void {
const ValidTargets = [...Targets].join(', ');

module.exports = function (argv: string[]): void {
const program = new Command();

program.version(pkg.version).usage('<command>');

program
Expand Down Expand Up @@ -220,7 +222,8 @@ module.exports = function (argv: string[]): void {
.option('--baseImagesUrl <url>', 'Prepend all relative image links in README.md with the specified URL.')
.option('--yarn', 'Use yarn instead of npm (default inferred from presence of yarn.lock or .yarnrc)')
.option('--no-yarn', 'Use npm instead of yarn (default inferred from absence of yarn.lock or .yarnrc)')
.option('--noVerify', 'Allow all proposed APIs (deprecated: use --allow-all-proposed-apis instead)')
.option('--no-verify', 'Allow all proposed APIs (deprecated: use --allow-all-proposed-apis instead)')
.addOption(new Option('--noVerify', 'Allow all proposed APIs (deprecated: use --allow-all-proposed-apis instead)').hideHelp(true))
.option('--allow-proposed-apis <apis...>', 'Allow specific proposed APIs')
.option('--allow-all-proposed-apis', 'Allow all proposed APIs')
.option('--ignoreFile <path>', 'Indicate alternative .vscodeignore')
Expand Down Expand Up @@ -256,6 +259,7 @@ module.exports = function (argv: string[]): void {
baseContentUrl,
baseImagesUrl,
yarn,
verify,
noVerify,
allowProposedApis,
allowAllProposedApis,
Expand Down Expand Up @@ -292,7 +296,7 @@ module.exports = function (argv: string[]): void {
baseContentUrl,
baseImagesUrl,
useYarn: yarn,
noVerify,
noVerify: noVerify || !verify,
allowProposedApis,
allowAllProposedApis,
ignoreFile,
Expand Down Expand Up @@ -387,7 +391,7 @@ module.exports = function (argv: string[]): void {
}

program.outputHelp(help => {
const availableCommands = program.commands.map(c => c._name);
const availableCommands = program.commands.map(c => c.name());
const suggestion = availableCommands.find(c => leven(c, cmd) < c.length * 0.4);

help = `${help}\n Unknown command '${cmd}'`;
Expand Down