Path: blob/main/src/vs/platform/environment/node/argv.ts
5221 views
/*---------------------------------------------------------------------------------------------1* Copyright (c) Microsoft Corporation. All rights reserved.2* Licensed under the MIT License. See License.txt in the project root for license information.3*--------------------------------------------------------------------------------------------*/45import minimist from 'minimist';6import { isWindows } from '../../../base/common/platform.js';7import { localize } from '../../../nls.js';8import { NativeParsedArgs } from '../common/argv.js';910/**11* This code is also used by standalone cli's. Avoid adding any other dependencies.12*/13const helpCategories = {14o: localize('optionsUpperCase', "Options"),15e: localize('extensionsManagement', "Extensions Management"),16t: localize('troubleshooting', "Troubleshooting"),17m: localize('mcp', "Model Context Protocol")18};1920export interface Option<OptionType> {21type: OptionType;22alias?: string;23deprecates?: string[]; // old deprecated ids24args?: string | string[];25description?: string;26deprecationMessage?: string;27allowEmptyValue?: boolean;28cat?: keyof typeof helpCategories;29global?: boolean;30}3132export interface Subcommand<T> {33type: 'subcommand';34description?: string;35deprecationMessage?: string;36options: OptionDescriptions<Required<T>>;37}3839export type OptionDescriptions<T> = {40[P in keyof T]:41T[P] extends boolean | undefined ? Option<'boolean'> :42T[P] extends string | undefined ? Option<'string'> :43T[P] extends string[] | undefined ? Option<'string[]'> :44Subcommand<T[P]>45};4647export const NATIVE_CLI_COMMANDS = ['tunnel', 'serve-web'] as const;4849export const OPTIONS: OptionDescriptions<Required<NativeParsedArgs>> = {50'chat': {51type: 'subcommand',52description: 'Pass in a prompt to run in a chat session in the current working directory.',53options: {54'_': { type: 'string[]', description: localize('prompt', "The prompt to use as chat.") },55'mode': { type: 'string', cat: 'o', alias: 'm', args: 'mode', description: localize('chatMode', "The mode to use for the chat session. Available options: 'ask', 'edit', 'agent', or the identifier of a custom mode. Defaults to 'agent'.") },56'add-file': { type: 'string[]', cat: 'o', alias: 'a', args: 'path', description: localize('addFile', "Add files as context to the chat session.") },57'maximize': { type: 'boolean', cat: 'o', description: localize('chatMaximize', "Maximize the chat session view.") },58'reuse-window': { type: 'boolean', cat: 'o', alias: 'r', description: localize('reuseWindowForChat', "Force to use the last active window for the chat session.") },59'new-window': { type: 'boolean', cat: 'o', alias: 'n', description: localize('newWindowForChat', "Force to open an empty window for the chat session.") },60'profile': { type: 'string', 'cat': 'o', args: 'profileName', description: localize('profileName', "Opens the provided folder or workspace with the given profile and associates the profile with the workspace. If the profile does not exist, a new empty one is created.") },61'help': { type: 'boolean', alias: 'h', description: localize('help', "Print usage.") }62}63},64'serve-web': {65type: 'subcommand',66description: 'Run a server that displays the editor UI in browsers.',67options: {68'cli-data-dir': { type: 'string', args: 'dir', description: localize('cliDataDir', "Directory where CLI metadata should be stored.") },69'disable-telemetry': { type: 'boolean' },70'telemetry-level': { type: 'string' },71}72},73'tunnel': {74type: 'subcommand',75description: 'Make the current machine accessible from vscode.dev or other machines through a secure tunnel.',76options: {77'cli-data-dir': { type: 'string', args: 'dir', description: localize('cliDataDir', "Directory where CLI metadata should be stored.") },78'disable-telemetry': { type: 'boolean' },79'telemetry-level': { type: 'string' },80user: {81type: 'subcommand',82options: {83login: {84type: 'subcommand',85options: {86provider: { type: 'string' },87'access-token': { type: 'string' }88}89}90}91}92}93},94'diff': { type: 'boolean', cat: 'o', alias: 'd', args: ['file', 'file'], description: localize('diff', "Compare two files with each other.") },95'merge': { type: 'boolean', cat: 'o', alias: 'm', args: ['path1', 'path2', 'base', 'result'], description: localize('merge', "Perform a three-way merge by providing paths for two modified versions of a file, the common origin of both modified versions and the output file to save merge results.") },96'add': { type: 'boolean', cat: 'o', alias: 'a', args: 'folder', description: localize('add', "Add folder(s) to the last active window.") },97'remove': { type: 'boolean', cat: 'o', args: 'folder', description: localize('remove', "Remove folder(s) from the last active window.") },98'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.") },99'new-window': { type: 'boolean', cat: 'o', alias: 'n', description: localize('newWindow', "Force to open a new window.") },100'reuse-window': { type: 'boolean', cat: 'o', alias: 'r', description: localize('reuseWindow', "Force to open a file or folder in an already opened window.") },101'wait': { type: 'boolean', cat: 'o', alias: 'w', description: localize('wait', "Wait for the files to be closed before returning.") },102'waitMarkerFilePath': { type: 'string' },103'locale': { type: 'string', cat: 'o', args: 'locale', description: localize('locale', "The locale to use (e.g. en-US or zh-TW).") },104'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.") },105'profile': { type: 'string', 'cat': 'o', args: 'profileName', description: localize('profileName', "Opens the provided folder or workspace with the given profile and associates the profile with the workspace. If the profile does not exist, a new empty one is created.") },106'help': { type: 'boolean', cat: 'o', alias: 'h', description: localize('help', "Print usage.") },107108'extensions-dir': { type: 'string', deprecates: ['extensionHomePath'], cat: 'e', args: 'dir', description: localize('extensionHomePath', "Set the root path for extensions.") },109'extensions-download-dir': { type: 'string' },110'builtin-extensions-dir': { type: 'string' },111'list-extensions': { type: 'boolean', cat: 'e', description: localize('listExtensions', "List the installed extensions.") },112'show-versions': { type: 'boolean', cat: 'e', description: localize('showVersions', "Show versions of installed extensions, when using --list-extensions.") },113'category': { type: 'string', allowEmptyValue: true, cat: 'e', description: localize('category', "Filters installed extensions by provided category, when using --list-extensions."), args: 'category' },114'install-extension': { type: 'string[]', cat: 'e', args: 'ext-id | path', description: localize('installExtension', "Installs or updates an extension. The argument is either an extension id or a path to a VSIX. The identifier of an extension is '${publisher}.${name}'. Use '--force' argument to update to latest version. To install a specific version provide '@${version}'. For example: '[email protected]'.") },115'pre-release': { type: 'boolean', cat: 'e', description: localize('install prerelease', "Installs the pre-release version of the extension, when using --install-extension") },116'uninstall-extension': { type: 'string[]', cat: 'e', args: 'ext-id', description: localize('uninstallExtension', "Uninstalls an extension.") },117'update-extensions': { type: 'boolean', cat: 'e', description: localize('updateExtensions', "Update the installed extensions.") },118'enable-proposed-api': { type: 'string[]', allowEmptyValue: true, cat: 'e', args: 'ext-id', description: localize('experimentalApis', "Enables proposed API features for extensions. Can receive one or more extension IDs to enable individually.") },119120'add-mcp': { type: 'string[]', cat: 'm', args: 'json', description: localize('addMcp', "Adds a Model Context Protocol server definition to the user profile. Accepts JSON input in the form '{\"name\":\"server-name\",\"command\":...}'") },121122'version': { type: 'boolean', cat: 't', alias: 'v', description: localize('version', "Print version.") },123'verbose': { type: 'boolean', cat: 't', global: true, description: localize('verbose', "Print verbose output (implies --wait).") },124'log': { type: 'string[]', cat: 't', args: 'level', global: true, description: localize('log', "Log level to use. Default is 'info'. Allowed values are 'critical', 'error', 'warn', 'info', 'debug', 'trace', 'off'. You can also configure the log level of an extension by passing extension id and log level in the following format: '${publisher}.${name}:${logLevel}'. For example: 'vscode.csharp:trace'. Can receive one or more such entries.") },125'status': { type: 'boolean', alias: 's', cat: 't', description: localize('status', "Print process usage and diagnostics information.") },126'prof-startup': { type: 'boolean', cat: 't', description: localize('prof-startup', "Run CPU profiler during startup.") },127'prof-append-timers': { type: 'string' },128'prof-duration-markers': { type: 'string[]' },129'prof-duration-markers-file': { type: 'string' },130'no-cached-data': { type: 'boolean' },131'prof-startup-prefix': { type: 'string' },132'prof-v8-extensions': { type: 'boolean' },133'disable-extensions': { type: 'boolean', deprecates: ['disableExtensions'], cat: 't', description: localize('disableExtensions', "Disable all installed extensions. This option is not persisted and is effective only when the command opens a new window.") },134'disable-extension': { type: 'string[]', cat: 't', args: 'ext-id', description: localize('disableExtension', "Disable the provided extension. This option is not persisted and is effective only when the command opens a new window.") },135'sync': { type: 'string', cat: 't', description: localize('turn sync', "Turn sync on or off."), args: ['on | off'] },136137'inspect-extensions': { type: 'string', allowEmptyValue: true, deprecates: ['debugPluginHost'], args: 'port', cat: 't', description: localize('inspect-extensions', "Allow debugging and profiling of extensions. Check the developer tools for the connection URI.") },138'inspect-brk-extensions': { type: 'string', allowEmptyValue: true, deprecates: ['debugBrkPluginHost'], args: 'port', cat: 't', description: localize('inspect-brk-extensions', "Allow debugging and profiling of extensions with the extension host being paused after start. Check the developer tools for the connection URI.") },139'disable-lcd-text': { type: 'boolean', cat: 't', description: localize('disableLCDText', "Disable LCD font rendering.") },140'disable-gpu': { type: 'boolean', cat: 't', description: localize('disableGPU', "Disable GPU hardware acceleration.") },141'disable-chromium-sandbox': { type: 'boolean', cat: 't', description: localize('disableChromiumSandbox', "Use this option only when there is requirement to launch the application as sudo user on Linux or when running as an elevated user in an applocker environment on Windows.") },142'sandbox': { type: 'boolean' },143'locate-shell-integration-path': { type: 'string', cat: 't', args: ['shell'], description: localize('locateShellIntegrationPath', "Print the path to a terminal shell integration script. Allowed values are 'bash', 'pwsh', 'zsh' or 'fish'.") },144'telemetry': { type: 'boolean', cat: 't', description: localize('telemetry', "Shows all telemetry events which VS code collects.") },145146'remote': { type: 'string', allowEmptyValue: true },147'folder-uri': { type: 'string[]', cat: 'o', args: 'uri' },148'file-uri': { type: 'string[]', cat: 'o', args: 'uri' },149150'locate-extension': { type: 'string[]' },151'extensionDevelopmentPath': { type: 'string[]' },152'extensionDevelopmentKind': { type: 'string[]' },153'extensionTestsPath': { type: 'string' },154'extensionEnvironment': { type: 'string' },155'debugId': { type: 'string' },156'debugRenderer': { type: 'boolean' },157'inspect-ptyhost': { type: 'string', allowEmptyValue: true },158'inspect-brk-ptyhost': { type: 'string', allowEmptyValue: true },159'inspect-search': { type: 'string', deprecates: ['debugSearch'], allowEmptyValue: true },160'inspect-brk-search': { type: 'string', deprecates: ['debugBrkSearch'], allowEmptyValue: true },161'inspect-sharedprocess': { type: 'string', allowEmptyValue: true },162'inspect-brk-sharedprocess': { type: 'string', allowEmptyValue: true },163'export-default-configuration': { type: 'string' },164'export-policy-data': { type: 'string', allowEmptyValue: true },165'install-source': { type: 'string' },166'enable-smoke-test-driver': { type: 'boolean' },167'logExtensionHostCommunication': { type: 'boolean' },168'skip-release-notes': { type: 'boolean' },169'skip-welcome': { type: 'boolean' },170'disable-telemetry': { type: 'boolean' },171'disable-updates': { type: 'boolean' },172'transient': { type: 'boolean', cat: 't', description: localize('transient', "Run with temporary data and extension directories, as if launched for the first time.") },173'use-inmemory-secretstorage': { type: 'boolean', deprecates: ['disable-keytar'] },174'password-store': { type: 'string' },175'disable-workspace-trust': { type: 'boolean' },176'disable-crash-reporter': { type: 'boolean' },177'crash-reporter-directory': { type: 'string' },178'crash-reporter-id': { type: 'string' },179'skip-add-to-recently-opened': { type: 'boolean' },180'open-url': { type: 'boolean' },181'file-write': { type: 'boolean' },182'file-chmod': { type: 'boolean' },183'install-builtin-extension': { type: 'string[]' },184'force': { type: 'boolean' },185'do-not-sync': { type: 'boolean' },186'do-not-include-pack-dependencies': { type: 'boolean' },187'trace': { type: 'boolean' },188'trace-memory-infra': { type: 'boolean' },189'trace-category-filter': { type: 'string' },190'trace-options': { type: 'string' },191'preserve-env': { type: 'boolean' },192'force-user-env': { type: 'boolean' },193'force-disable-user-env': { type: 'boolean' },194'open-devtools': { type: 'boolean' },195'disable-gpu-sandbox': { type: 'boolean' },196'logsPath': { type: 'string' },197'__enable-file-policy': { type: 'boolean' },198'editSessionId': { type: 'string' },199'continueOn': { type: 'string' },200'enable-coi': { type: 'boolean' },201'unresponsive-sample-interval': { type: 'string' },202'unresponsive-sample-period': { type: 'string' },203'enable-rdp-display-tracking': { type: 'boolean' },204'disable-layout-restore': { type: 'boolean' },205'disable-experiments': { type: 'boolean' },206207// chromium flags208'no-proxy-server': { type: 'boolean' },209// Minimist incorrectly parses keys that start with `--no`210// https://github.com/substack/minimist/blob/aeb3e27dae0412de5c0494e9563a5f10c82cc7a9/index.js#L118-L121211// If --no-sandbox is passed via cli wrapper it will be treated as --sandbox which is incorrect, we use212// the alias here to make sure --no-sandbox is always respected.213// For https://github.com/microsoft/vscode/issues/128279214'no-sandbox': { type: 'boolean', alias: 'sandbox' },215'proxy-server': { type: 'string' },216'proxy-bypass-list': { type: 'string' },217'proxy-pac-url': { type: 'string' },218'js-flags': { type: 'string' }, // chrome js flags219'inspect': { type: 'string', allowEmptyValue: true },220'inspect-brk': { type: 'string', allowEmptyValue: true },221'nolazy': { type: 'boolean' }, // node inspect222'force-device-scale-factor': { type: 'string' },223'force-renderer-accessibility': { type: 'boolean' },224'ignore-certificate-errors': { type: 'boolean' },225'allow-insecure-localhost': { type: 'boolean' },226'log-net-log': { type: 'string' },227'vmodule': { type: 'string' },228'_urls': { type: 'string[]' },229'disable-dev-shm-usage': { type: 'boolean' },230'profile-temp': { type: 'boolean' },231'ozone-platform': { type: 'string' },232'enable-tracing': { type: 'string' },233'trace-startup-format': { type: 'string' },234'trace-startup-file': { type: 'string' },235'trace-startup-duration': { type: 'string' },236'xdg-portal-required-version': { type: 'string' },237238_: { type: 'string[]' } // main arguments239};240241export interface ErrorReporter {242onUnknownOption(id: string): void;243onMultipleValues(id: string, usedValue: string): void;244onEmptyValue(id: string): void;245onDeprecatedOption(deprecatedId: string, message: string): void;246247getSubcommandReporter?(command: string): ErrorReporter;248}249250const ignoringReporter = {251onUnknownOption: () => { },252onMultipleValues: () => { },253onEmptyValue: () => { },254onDeprecatedOption: () => { }255};256257export function parseArgs<T>(args: string[], options: OptionDescriptions<T>, errorReporter: ErrorReporter = ignoringReporter): T {258// Find the first non-option arg, which also isn't the value for a previous `--flag`259const firstPossibleCommand = args.find((a, i) => a.length > 0 && a[0] !== '-' && options.hasOwnProperty(a) && options[a as T].type === 'subcommand');260261const alias: { [key: string]: string } = {};262const stringOptions: string[] = ['_'];263const booleanOptions: string[] = [];264const globalOptions: Record<string, Option<'boolean'> | Option<'string'> | Option<'string[]'>> = {};265let command: Subcommand<Record<string, unknown>> | undefined = undefined;266for (const optionId in options) {267const o = options[optionId];268if (o.type === 'subcommand') {269if (optionId === firstPossibleCommand) {270command = o;271}272} else {273if (o.alias) {274alias[optionId] = o.alias;275}276277if (o.type === 'string' || o.type === 'string[]') {278stringOptions.push(optionId);279if (o.deprecates) {280stringOptions.push(...o.deprecates);281}282} else if (o.type === 'boolean') {283booleanOptions.push(optionId);284if (o.deprecates) {285booleanOptions.push(...o.deprecates);286}287}288if (o.global) {289globalOptions[optionId] = o;290}291}292}293if (command && firstPossibleCommand) {294const options: Record<string, Option<'boolean'> | Option<'string'> | Option<'string[]'> | Subcommand<Record<string, unknown>>> = globalOptions;295for (const optionId in command.options) {296options[optionId] = command.options[optionId];297}298const newArgs = args.filter(a => a !== firstPossibleCommand);299const reporter = errorReporter.getSubcommandReporter ? errorReporter.getSubcommandReporter(firstPossibleCommand) : undefined;300const subcommandOptions = parseArgs(newArgs, options as OptionDescriptions<Record<string, unknown>>, reporter);301// eslint-disable-next-line local/code-no-dangerous-type-assertions302return <T>{303[firstPossibleCommand]: subcommandOptions,304_: []305};306}307308309// remove aliases to avoid confusion310const parsedArgs = minimist(args, { string: stringOptions, boolean: booleanOptions, alias });311312const cleanedArgs: Record<string, unknown> = {};313const remainingArgs: Record<string, unknown> = parsedArgs;314315// https://github.com/microsoft/vscode/issues/58177, https://github.com/microsoft/vscode/issues/106617316cleanedArgs._ = parsedArgs._.map(arg => String(arg)).filter(arg => arg.length > 0);317318delete remainingArgs._;319320for (const optionId in options) {321const o = options[optionId];322if (o.type === 'subcommand') {323continue;324}325if (o.alias) {326delete remainingArgs[o.alias];327}328329let val = remainingArgs[optionId];330if (o.deprecates) {331for (const deprecatedId of o.deprecates) {332if (remainingArgs.hasOwnProperty(deprecatedId)) {333if (!val) {334val = remainingArgs[deprecatedId];335if (val) {336errorReporter.onDeprecatedOption(deprecatedId, o.deprecationMessage || localize('deprecated.useInstead', 'Use {0} instead.', optionId));337}338}339delete remainingArgs[deprecatedId];340}341}342}343344if (typeof val !== 'undefined') {345if (o.type === 'string[]') {346if (!Array.isArray(val)) {347val = [val];348}349if (!o.allowEmptyValue) {350const sanitized = (val as string[]).filter((v: string) => v.length > 0);351if (sanitized.length !== (val as string[]).length) {352errorReporter.onEmptyValue(optionId);353val = sanitized.length > 0 ? sanitized : undefined;354}355}356} else if (o.type === 'string') {357if (Array.isArray(val)) {358val = val.pop(); // take the last359errorReporter.onMultipleValues(optionId, val as string);360} else if (!val && !o.allowEmptyValue) {361errorReporter.onEmptyValue(optionId);362val = undefined;363}364}365cleanedArgs[optionId] = val;366367if (o.deprecationMessage) {368errorReporter.onDeprecatedOption(optionId, o.deprecationMessage);369}370}371delete remainingArgs[optionId];372}373374for (const key in remainingArgs) {375errorReporter.onUnknownOption(key);376}377378return cleanedArgs as T;379}380381function formatUsage(optionId: string, option: Option<'boolean'> | Option<'string'> | Option<'string[]'>) {382let args = '';383if (option.args) {384if (Array.isArray(option.args)) {385args = ` <${option.args.join('> <')}>`;386} else {387args = ` <${option.args}>`;388}389}390if (option.alias) {391return `-${option.alias} --${optionId}${args}`;392}393return `--${optionId}${args}`;394}395396// exported only for testing397export function formatOptions(options: OptionDescriptions<unknown> | Record<string, Option<'boolean'> | Option<'string'> | Option<'string[]'>>, columns: number): string[] {398const usageTexts: [string, string][] = [];399for (const optionId in options) {400const o = options[optionId as keyof typeof options] as Option<'boolean'> | Option<'string'> | Option<'string[]'>;401const usageText = formatUsage(optionId, o);402usageTexts.push([usageText, o.description!]);403}404return formatUsageTexts(usageTexts, columns);405}406407function formatUsageTexts(usageTexts: [string, string][], columns: number) {408const maxLength = usageTexts.reduce((previous, e) => Math.max(previous, e[0].length), 12);409const argLength = maxLength + 2/*left padding*/ + 1/*right padding*/;410if (columns - argLength < 25) {411// Use a condensed version on narrow terminals412return usageTexts.reduce<string[]>((r, ut) => r.concat([` ${ut[0]}`, ` ${ut[1]}`]), []);413}414const descriptionColumns = columns - argLength - 1;415const result: string[] = [];416for (const ut of usageTexts) {417const usage = ut[0];418const wrappedDescription = wrapText(ut[1], descriptionColumns);419const keyPadding = indent(argLength - usage.length - 2/*left padding*/);420result.push(' ' + usage + keyPadding + wrappedDescription[0]);421for (let i = 1; i < wrappedDescription.length; i++) {422result.push(indent(argLength) + wrappedDescription[i]);423}424}425return result;426}427428function indent(count: number): string {429return ' '.repeat(count);430}431432function wrapText(text: string, columns: number): string[] {433const lines: string[] = [];434while (text.length) {435let index = text.length < columns ? text.length : text.lastIndexOf(' ', columns);436if (index === 0) {437index = columns;438}439const line = text.slice(0, index).trim();440text = text.slice(index).trimStart();441lines.push(line);442}443return lines;444}445446export function buildHelpMessage(productName: string, executableName: string, version: string, options: OptionDescriptions<unknown> | Record<string, Option<'boolean'> | Option<'string'> | Option<'string[]'> | Subcommand<Record<string, unknown>>>, capabilities?: { noPipe?: boolean; noInputFiles?: boolean; isChat?: boolean }): string {447const columns = (process.stdout).isTTY && (process.stdout).columns || 80;448const inputFiles = capabilities?.noInputFiles ? '' : capabilities?.isChat ? ` [${localize('cliPrompt', 'prompt')}]` : ` [${localize('paths', 'paths')}...]`;449const subcommand = capabilities?.isChat ? ' chat' : '';450451const help = [`${productName} ${version}`];452help.push('');453help.push(`${localize('usage', "Usage")}: ${executableName}${subcommand} [${localize('options', "options")}]${inputFiles}`);454help.push('');455if (capabilities?.noPipe !== true) {456help.push(buildStdinMessage(executableName, capabilities?.isChat));457help.push('');458}459const optionsByCategory: { [P in keyof typeof helpCategories]?: Record<string, Option<'boolean'> | Option<'string'> | Option<'string[]'>> } = {};460const subcommands: { command: string; description: string }[] = [];461for (const optionId in options) {462const o = options[optionId as keyof typeof options] as Option<'boolean'> | Option<'string'> | Option<'string[]'> | Subcommand<Record<string, unknown>>;463if (o.type === 'subcommand') {464if (o.description) {465subcommands.push({ command: optionId, description: o.description });466}467} else if (o.description && o.cat) {468const cat = o.cat;469let optionsByCat = optionsByCategory[cat];470if (!optionsByCat) {471optionsByCategory[cat] = optionsByCat = {};472}473optionsByCat[optionId] = o;474}475}476477for (const helpCategoryKey in optionsByCategory) {478const key = <keyof typeof helpCategories>helpCategoryKey;479480const categoryOptions = optionsByCategory[key];481if (categoryOptions) {482help.push(helpCategories[key]);483help.push(...formatOptions(categoryOptions, columns));484help.push('');485}486}487488if (subcommands.length) {489help.push(localize('subcommands', "Subcommands"));490help.push(...formatUsageTexts(subcommands.map(s => [s.command, s.description]), columns));491help.push('');492}493494return help.join('\n');495}496497export function buildStdinMessage(executableName: string, isChat?: boolean): string {498let example: string;499if (isWindows) {500if (isChat) {501example = `echo Hello World | ${executableName} chat <prompt> -`;502} else {503example = `echo Hello World | ${executableName} -`;504}505} else {506if (isChat) {507example = `ps aux | grep code | ${executableName} chat <prompt> -`;508} else {509example = `ps aux | grep code | ${executableName} -`;510}511}512513return localize('stdinUsage', "To read from stdin, append '-' (e.g. '{0}')", example);514}515516export function buildVersionMessage(version: string | undefined, commit: string | undefined): string {517return `${version || localize('unknownVersion', "Unknown version")}\n${commit || localize('unknownCommit', "Unknown commit")}\n${process.arch}`;518}519520521