From 82a9052ce7c79e9136ac8fa3ae2c901bd4b8e156 Mon Sep 17 00:00:00 2001 From: Martin Aeschlimann Date: Tue, 10 Sep 2019 16:17:42 +0200 Subject: [PATCH] more cli args cleanup --- src/vs/platform/environment/common/environment.ts | 6 +----- src/vs/platform/environment/node/argv.ts | 13 +++++++++++-- .../platform/environment/node/environmentService.ts | 4 +--- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/vs/platform/environment/common/environment.ts b/src/vs/platform/environment/common/environment.ts index f60b09ad56f91..7f77b7a084d8f 100644 --- a/src/vs/platform/environment/common/environment.ts +++ b/src/vs/platform/environment/common/environment.ts @@ -71,17 +71,13 @@ export interface ParsedArgs { 'driver-verbose'?: boolean; remote?: string; 'disable-user-env-probe'?: boolean; - 'enable-remote-auto-shutdown'?: boolean; 'disable-inspect'?: boolean; 'force'?: boolean; - 'gitCredential'?: string; + // node flags 'js-flags'?: string; 'disable-gpu'?: boolean; 'nolazy'?: boolean; - - // Web flags - 'web-user-data-dir'?: string; } export const IEnvironmentService = createDecorator('environmentService'); diff --git a/src/vs/platform/environment/node/argv.ts b/src/vs/platform/environment/node/argv.ts index c0e258cafc404..3c72aa1524280 100644 --- a/src/vs/platform/environment/node/argv.ts +++ b/src/vs/platform/environment/node/argv.ts @@ -40,13 +40,14 @@ type OptionTypeName = T extends undefined ? 'undefined' : 'unknown'; -export const OPTIONS: OptionDescriptions = { +export const OPTIONS: OptionDescriptions> = { 'diff': { type: 'boolean', cat: 'o', alias: 'd', args: ['file', 'file'], description: localize('diff', "Compare two files with each other.") }, 'add': { type: 'boolean', cat: 'o', alias: 'a', args: 'folder', description: localize('add', "Add folder(s) to the last active window.") }, 'goto': { type: 'boolean', cat: 'o', alias: 'g', args: 'file:line[:character]', description: localize('goto', "Open a file at the path on the specified line and character position.") }, 'new-window': { type: 'boolean', cat: 'o', alias: 'n', description: localize('newWindow', "Force to open a new window.") }, 'reuse-window': { type: 'boolean', cat: 'o', alias: 'r', description: localize('reuseWindow', "Force to open a file or folder in an already opened window.") }, 'wait': { type: 'boolean', cat: 'o', alias: 'w', description: localize('wait', "Wait for the files to be closed before returning.") }, + 'waitMarkerFilePath': { type: 'string' }, 'locale': { type: 'string', cat: 'o', args: 'locale', description: localize('locale', "The locale to use (e.g. en-US or zh-TW).") }, 'user-data-dir': { type: 'string', cat: 'o', args: 'dir', description: localize('userDataDir', "Specifies the directory that user data is kept in. Can be used to open multiple distinct instances of Code.") }, 'version': { type: 'boolean', cat: 'o', alias: 'v', description: localize('version', "Print version.") }, @@ -56,6 +57,7 @@ export const OPTIONS: OptionDescriptions = { 'file-uri': { type: 'string[]', cat: 'o', args: 'uri', description: localize('fileUri', "Opens a window with given file uri(s)") }, 'extensions-dir': { type: 'string', deprecates: 'extensionHomePath', cat: 'e', args: 'dir', description: localize('extensionHomePath', "Set the root path for extensions.") }, + 'builtin-extensions-dir': { type: 'string' }, 'list-extensions': { type: 'boolean', cat: 'e', description: localize('listExtensions', "List the installed extensions.") }, 'show-versions': { type: 'boolean', cat: 'e', description: localize('showVersions', "Show versions of installed extensions, when using --list-extension.") }, 'category': { type: 'string', cat: 'e', description: localize('category', "Filters installed extensions by provided category, when using --list-extension.") }, @@ -67,8 +69,8 @@ export const OPTIONS: OptionDescriptions = { 'log': { type: 'string', cat: 't', args: 'level', description: localize('log', "Log level to use. Default is 'info'. Allowed values are 'critical', 'error', 'warn', 'info', 'debug', 'trace', 'off'.") }, 'status': { type: 'boolean', alias: 's', cat: 't', description: localize('status', "Print process usage and diagnostics information.") }, 'prof-startup': { type: 'boolean', cat: 't', description: localize('prof-startup', "Run CPU profiler during startup") }, - 'prof-startup-prefix': { type: 'string' }, 'prof-append-timers': { type: 'string' }, + 'prof-startup-prefix': { type: 'string' }, 'disable-extensions': { type: 'boolean', deprecates: 'disableExtensions', cat: 't', description: localize('disableExtensions', "Disable all installed extensions.") }, 'disable-extension': { type: 'string[]', cat: 't', args: 'extension-id', description: localize('disableExtension', "Disable an extension.") }, @@ -96,6 +98,7 @@ export const OPTIONS: OptionDescriptions = { 'disable-telemetry': { type: 'boolean' }, 'disable-updates': { type: 'boolean' }, 'disable-crash-reporter': { type: 'boolean' }, + 'disable-user-env-probe': { type: 'boolean' }, 'skip-add-to-recently-opened': { type: 'boolean' }, 'unity-launch': { type: 'boolean' }, 'open-url': { type: 'boolean' }, @@ -103,12 +106,14 @@ export const OPTIONS: OptionDescriptions = { 'file-chmod': { type: 'boolean' }, 'driver-verbose': { type: 'boolean' }, 'force': { type: 'boolean' }, + 'trace': { type: 'boolean' }, 'trace-category-filter': { type: 'string' }, 'trace-options': { type: 'string' }, 'disable-inspect': { type: 'boolean' }, 'js-flags': { type: 'string' }, // chrome js flags 'nolazy': { type: 'boolean' }, // node inspect + '_urls': { type: 'string[]' }, _: { type: 'string[]' } // main arguments }; @@ -128,6 +133,10 @@ export function parseArgs(args: string[], options: OptionDescriptions, err const string: string[] = []; const boolean: string[] = []; for (let optionId in options) { + if (optionId[0] === '_') { + continue; + } + const o = options[optionId]; if (o.alias) { alias[optionId] = o.alias; diff --git a/src/vs/platform/environment/node/environmentService.ts b/src/vs/platform/environment/node/environmentService.ts index e0cc96ad33b72..1c3df4cac7e04 100644 --- a/src/vs/platform/environment/node/environmentService.ts +++ b/src/vs/platform/environment/node/environmentService.ts @@ -104,8 +104,6 @@ export class EnvironmentService implements IEnvironmentService { return parseUserDataDir(this._args, process); } - @memoize - get webUserDataHome(): URI { return URI.file(parsePathArg(this._args['web-user-data-dir'], process) || this.userDataPath); } get appNameLong(): string { return product.nameLong; } @@ -285,7 +283,7 @@ function parseDebugPort(debugArg: string | undefined, debugBrkArg: string | unde return { port, break: brk, debugId }; } -function parsePathArg(arg: string | undefined, process: NodeJS.Process): string | undefined { +export function parsePathArg(arg: string | undefined, process: NodeJS.Process): string | undefined { if (!arg) { return undefined; }