本文整理汇总了TypeScript中vs/code/node/argv.parseArgs函数的典型用法代码示例。如果您正苦于以下问题:TypeScript parseArgs函数的具体用法?TypeScript parseArgs怎么用?TypeScript parseArgs使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了parseArgs函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: main
export function main(args: string[]) {
const argv = parseArgs(args);
if (argv.help) {
console.log(helpMessage);
} else if (argv.version) {
console.log(pkg.version);
} else {
const env = assign({}, process.env, {
// this will signal Code that it was spawned from this module
'VSCODE_CLI': '1',
'ELECTRON_NO_ATTACH_CONSOLE': '1'
});
delete env['ATOM_SHELL_INTERNAL_RUN_AS_NODE'];
const child = spawn(process.execPath, args, {
detached: true,
stdio: 'ignore',
env
});
if (argv.wait) {
child.on('exit', process.exit);
return;
}
}
process.exit(0);
}
开发者ID:Elflyy,项目名称:vscode,代码行数:29,代码来源:cli.ts
示例2: main
export function main(args: string[]): TPromise<void> {
const argv = parseArgs(args);
if (argv.help) {
console.log(helpMessage);
} else if (argv.version) {
console.log(pkg.version);
} else if (shouldSpawnCliProcess(argv)) {
const mainCli = new TPromise<IMainCli>(c => require(['vs/code/node/cliProcessMain'], c));
return mainCli.then(cli => cli.main(argv));
} else {
const env = assign({}, process.env, {
// this will signal Code that it was spawned from this module
'VSCODE_CLI': '1',
'ELECTRON_NO_ATTACH_CONSOLE': '1'
});
delete env['ATOM_SHELL_INTERNAL_RUN_AS_NODE'];
const child = spawn(process.execPath, args, {
detached: true,
stdio: 'ignore',
env
});
if (argv.wait) {
return new TPromise<void>(c => child.once('exit', ()=> c(null)));
}
}
return TPromise.as(null);
}
开发者ID:13572293130,项目名称:vscode,代码行数:31,代码来源:cli.ts
示例3: constructor
constructor() {
this._appRoot = path.dirname(URI.parse(require.toUrl('')).fsPath);
this._currentWorkingDirectory = process.env['VSCODE_CWD'] || process.cwd();
this._appHome = app.getPath('userData');
this._appSettingsHome = path.join(this._appHome, 'User');
this._appSettingsPath = path.join(this._appSettingsHome, 'settings.json');
this._appKeybindingsPath = path.join(this._appSettingsHome, 'keybindings.json');
// Remove the Electron executable
let [, ...args] = process.argv;
// If dev, remove the first non-option argument: it's the app location
if (!this.isBuilt) {
const index = arrays.firstIndex(args, a => !/^-/.test(a));
if (index > -1) {
args.splice(index, 1);
}
}
// Finally, prepend any extra arguments from the 'argv' file
if (fs.existsSync(path.join(this._appRoot, 'argv'))) {
const extraargs: string[] = JSON.parse(fs.readFileSync(path.join(this._appRoot, 'argv'), 'utf8'));
args = [...extraargs, ...args];
}
const argv = parseArgs(args);
const paths = parsePathArguments(this._currentWorkingDirectory, argv._, argv.goto);
this._cliArgs = Object.freeze({
_: [],
paths,
performance: argv.performance,
verbose: argv.verbose,
debugPluginHost: argv.debugPluginHost,
debugBrkPluginHost: argv.debugBrkPluginHost,
logExtensionHostCommunication: argv.logExtensionHostCommunication,
'new-window': argv['new-window'],
'reuse-window': argv['reuse-window'],
goto: argv.goto,
diff: argv.diff && paths.length === 2,
extensionHomePath: normalizePath(argv.extensionHomePath),
extensionDevelopmentPath: normalizePath(argv.extensionDevelopmentPath),
extensionTestsPath: normalizePath(argv.extensionTestsPath),
'disable-extensions': argv['disable-extensions'],
locale: argv.locale,
wait: argv.wait
});
this._isTestingFromCli = this.cliArgs.extensionTestsPath && !this.cliArgs.debugBrkPluginHost;
this._userHome = path.join(os.homedir(), product.dataFolderName);
this._userExtensionsHome = this.cliArgs.extensionHomePath || path.join(this._userHome, 'extensions');
const prefix = this.getIPCHandleBaseName();
const suffix = process.platform === 'win32' ? '-sock' : '.sock';
this._mainIPCHandle = `${ prefix }-${ pkg.version }${ suffix }`;
this._sharedIPCHandle = `${ prefix }-${ pkg.version }-shared${ suffix }`;
}
开发者ID:rajkumar42,项目名称:vscode,代码行数:59,代码来源:env.ts
示例4: main
function main(server: Server): void {
const services = new ServiceCollection();
services.set(IEventService, new SyncDescriptor(EventService));
services.set(IEnvironmentService, new SyncDescriptor(EnvironmentService, parseArgs(process.argv), process.execPath));
services.set(IConfigurationService, new SyncDescriptor(ConfigurationService));
services.set(IRequestService, new SyncDescriptor(RequestService));
const instantiationService = new InstantiationService(services);
instantiationService.invokeFunction(accessor => {
const appenders: AppInsightsAppender[] = [];
if (product.aiConfig && product.aiConfig.key) {
appenders.push(new AppInsightsAppender(eventPrefix, null, product.aiConfig.key));
}
if (product.aiConfig && product.aiConfig.asimovKey) {
appenders.push(new AppInsightsAppender(eventPrefix, null, product.aiConfig.asimovKey));
}
// It is important to dispose the AI adapter properly because
// only then they flush remaining data.
process.once('exit', () => appenders.forEach(a => a.dispose()));
const appender = combinedAppender(...appenders);
server.registerChannel('telemetryAppender', new TelemetryAppenderChannel(appender));
const services = new ServiceCollection();
const { appRoot, extensionsPath, extensionDevelopmentPath, isBuilt } = accessor.get(IEnvironmentService);
if (isBuilt && !extensionDevelopmentPath && product.enableTelemetry) {
const config: ITelemetryServiceConfig = {
appender,
commonProperties: resolveCommonProperties(product.commit, pkg.version),
piiPaths: [appRoot, extensionsPath]
};
services.set(ITelemetryService, new SyncDescriptor(TelemetryService, config));
} else {
services.set(ITelemetryService, NullTelemetryService);
}
services.set(IExtensionManagementService, new SyncDescriptor(ExtensionManagementService));
services.set(IExtensionGalleryService, new SyncDescriptor(ExtensionGalleryService));
const instantiationService2 = instantiationService.createChild(services);
instantiationService2.invokeFunction(accessor => {
const extensionManagementService = accessor.get(IExtensionManagementService);
const channel = new ExtensionManagementChannel(extensionManagementService);
server.registerChannel('extensions', channel);
// eventually clean up old extensions
setTimeout(() => (extensionManagementService as ExtensionManagementService).removeDeprecatedExtensions(), 100);
});
});
}
开发者ID:eklavyamirani,项目名称:vscode,代码行数:58,代码来源:sharedProcessMain.ts
示例5: constructor
constructor() {
const argv = parseArgs(process.argv);
this._appRoot = path.dirname(URI.parse(require.toUrl('')).fsPath);
this._userDataPath = paths.getUserDataPath(process.platform, pkg.name, process.argv);
this._userHome = path.join(os.homedir(), product.dataFolderName);
this._extensionsPath = argv.extensionHomePath || path.join(this._userHome, 'extensions');
this._extensionsPath = path.normalize(this._extensionsPath);
this._extensionDevelopmentPath = argv.extensionDevelopmentPath;
}
开发者ID:1Hgm,项目名称:vscode,代码行数:12,代码来源:environmentService.ts
示例6: constructor
constructor() {
this._appRoot = path.dirname(URI.parse(require.toUrl('')).fsPath);
this._currentWorkingDirectory = process.env['VSCODE_CWD'] || process.cwd();
this._appHome = app.getPath('userData');
this._appSettingsHome = path.join(this._appHome, 'User');
this._appSettingsPath = path.join(this._appSettingsHome, 'settings.json');
this._appKeybindingsPath = path.join(this._appSettingsHome, 'keybindings.json');
// Remove the Electron executable
let [, ...args] = process.argv;
// If dev, remove the first non-option argument: it's the app location
if (!this.isBuilt) {
const index = arrays.firstIndex(args, a => !/^-/.test(a));
if (index > -1) {
args.splice(index, 1);
}
}
const argv = parseArgs(args);
const paths = parsePathArguments(this._currentWorkingDirectory, argv._, argv.goto);
this._cliArgs = Object.freeze({
_: [],
paths,
performance: argv.performance,
verbose: argv.verbose,
debugPluginHost: argv.debugPluginHost,
debugBrkPluginHost: argv.debugBrkPluginHost,
logExtensionHostCommunication: argv.logExtensionHostCommunication,
'new-window': argv['new-window'],
'reuse-window': argv['reuse-window'],
goto: argv.goto,
diff: argv.diff && paths.length === 2,
extensionHomePath: normalizePath(argv.extensionHomePath),
extensionDevelopmentPath: normalizePath(argv.extensionDevelopmentPath),
extensionTestsPath: normalizePath(argv.extensionTestsPath),
'disable-extensions': argv['disable-extensions'],
locale: argv.locale,
wait: argv.wait
});
this._userHome = path.join(os.homedir(), product.dataFolderName);
this._userExtensionsHome = this.cliArgs.extensionHomePath || path.join(this._userHome, 'extensions');
}
开发者ID:douglaseccker,项目名称:vscode,代码行数:46,代码来源:env.ts
示例7: main
export function main(args: string[]): TPromise<void> {
const argv = parseArgs(args);
if (argv.help) {
console.log(helpMessage);
} else if (argv.version) {
console.log(pkg.version);
} else if (shouldSpawnCliProcess(argv)) {
const mainCli = new TPromise<IMainCli>(c => require(['vs/code/node/cliProcessMain'], c));
return mainCli.then(cli => cli.main(argv));
} else {
const env = assign({}, process.env, {
// this will signal Code that it was spawned from this module
'VSCODE_CLI': '1',
'ELECTRON_NO_ATTACH_CONSOLE': '1'
});
delete env['ATOM_SHELL_INTERNAL_RUN_AS_NODE'];
let options = {
detacted: true,
env,
};
if (!argv.verbose) {
options['stdio'] = 'ignore';
}
const child = spawn(process.execPath, args, options);
if (argv.verbose) {
child.stdout.on('data', (data) => console.log(data.toString('utf8').trim()));
child.stderr.on('data', (data) => console.log(data.toString('utf8').trim()));
}
if (argv.wait || argv.verbose) {
return new TPromise<void>(c => child.once('exit', () => c(null)));
}
}
return TPromise.as(null);
}
开发者ID:ckapilla,项目名称:vscode,代码行数:40,代码来源:cli.ts
示例8: constructor
constructor() {
this._appRoot = path.dirname(URI.parse(require.toUrl('')).fsPath);
this._currentWorkingDirectory = process.env['VSCODE_CWD'] || process.cwd();
this._appHome = app.getPath('userData');
this._appSettingsHome = path.join(this._appHome, 'User');
this._appSettingsPath = path.join(this._appSettingsHome, 'settings.json');
this._appKeybindingsPath = path.join(this._appSettingsHome, 'keybindings.json');
// Remove the Electron executable
let [, ...args] = process.argv;
// If dev, remove the first non-option argument: it's the app location
if (!this.isBuilt) {
const index = arrays.firstIndex(args, a => !/^-/.test(a));
if (index > -1) {
args.splice(index, 1);
}
}
// Finally, prepend any extra arguments from the 'argv' file
if (fs.existsSync(path.join(this._appRoot, 'argv'))) {
const extraargs: string[] = JSON.parse(fs.readFileSync(path.join(this._appRoot, 'argv'), 'utf8'));
args = [...extraargs, ...args];
}
const argv = parseArgs(args);
const debugBrkExtensionHostPort = getNumericValue(argv.debugBrkPluginHost, 5870);
const debugExtensionHostPort = getNumericValue(argv.debugPluginHost, 5870, this.isBuilt ? void 0 : 5870);
const pathArguments = parsePathArguments(this._currentWorkingDirectory, argv._, argv.goto);
const timestamp = parseInt(argv.timestamp);
const debugBrkFileWatcherPort = getNumericValue(argv.debugBrkFileWatcherPort, void 0);
this._cliArgs = Object.freeze({
pathArguments: pathArguments,
programStart: types.isNumber(timestamp) ? timestamp : 0,
enablePerformance: argv.performance,
verboseLogging: argv.verbose,
debugExtensionHostPort: debugBrkExtensionHostPort || debugExtensionHostPort,
debugBrkExtensionHost: !!debugBrkExtensionHostPort,
logExtensionHostCommunication: argv.logExtensionHostCommunication,
debugBrkFileWatcherPort: debugBrkFileWatcherPort,
openNewWindow: argv['new-window'],
openInSameWindow: argv['reuse-window'],
gotoLineMode: argv.goto,
diffMode: argv.diff && pathArguments.length === 2,
extensionsHomePath: normalizePath(argv.extensionHomePath),
extensionDevelopmentPath: normalizePath(argv.extensionDevelopmentPath),
extensionTestsPath: normalizePath(argv.extensionTestsPath),
disableExtensions: argv['disable-extensions'],
locale: argv.locale,
waitForWindowClose: argv.wait
});
this._isTestingFromCli = this.cliArgs.extensionTestsPath && !this.cliArgs.debugBrkExtensionHost;
this._userHome = path.join(os.homedir(), product.dataFolderName);
this._userExtensionsHome = this.cliArgs.extensionsHomePath || path.join(this._userHome, 'extensions');
this._mainIPCHandle = this.getMainIPCHandle();
this._sharedIPCHandle = this.getSharedIPCHandle();
}
开发者ID:Ayush-Mahajan,项目名称:vscode,代码行数:61,代码来源:env.ts
示例9: parseExtensionHostPort
const parse = a => parseExtensionHostPort(parseArgs(a), false);
开发者ID:rajkumar42,项目名称:vscode,代码行数:1,代码来源:environmentService.test.ts
注:本文中的vs/code/node/argv.parseArgs函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论