Skip to content

Commit

Permalink
Update commander and fix microsoft#719
Browse files Browse the repository at this point in the history
  • Loading branch information
benibenj authored and luxass committed Dec 15, 2024
1 parent b305cd5 commit 134a165
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 19 deletions.
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 @@ -223,7 +225,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 @@ -259,6 +262,7 @@ module.exports = function (argv: string[]): void {
baseContentUrl,
baseImagesUrl,
yarn,
verify,
noVerify,
allowProposedApis,
allowAllProposedApis,
Expand Down Expand Up @@ -295,7 +299,7 @@ module.exports = function (argv: string[]): void {
baseContentUrl,
baseImagesUrl,
useYarn: yarn,
noVerify,
noVerify: noVerify || !verify,
allowProposedApis,
allowAllProposedApis,
ignoreFile,
Expand Down Expand Up @@ -390,7 +394,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

0 comments on commit 134a165

Please sign in to comment.