diff --git a/src/main.ts b/src/main.ts index 68d14e3a..7a315237 100644 --- a/src/main.ts +++ b/src/main.ts @@ -6,7 +6,7 @@ import { show } from './show'; import { search } from './search'; import { listPublishers, deletePublisher, loginPublisher, logoutPublisher, verifyPat } from './store'; import { getLatestVersion } from './npm'; -import { CancellationToken, log } from './util'; +import { CancellationToken, log, setMarketplaceUrl } from './util'; import * as semver from 'semver'; import { isatty } from 'tty'; @@ -64,6 +64,18 @@ module.exports = function (argv: string[]): void { program.version(pkg.version).usage(''); + program.option( + '--marketplace-url ', + 'Marketplace endpoint URL (defaults to VSCE_MARKETPLACE_URL environment variable or https://marketplace.visualstudio.com)' + ); + + program.hook('preAction', (thisCommand) => { + const opts = thisCommand.opts(); + if (opts.marketplaceUrl) { + setMarketplaceUrl(opts.marketplaceUrl); + } + }); + program .command('ls') .description('Lists all the files that will be published/packaged') diff --git a/src/util.ts b/src/util.ts index b18a4777..755aab5d 100644 --- a/src/util.ts +++ b/src/util.ts @@ -18,7 +18,11 @@ export function read(prompt: string, options: _read.Options = {}): Promise