fixed:移除无效的命令行工具中tunnel和serve命令.
This commit is contained in:
parent
8fa582f42d
commit
57fb93891d
|
@ -3,7 +3,7 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { ChildProcess, spawn, SpawnOptions, StdioOptions } from 'child_process';
|
||||
import { ChildProcess, spawn, SpawnOptions } from 'child_process';
|
||||
import { chmodSync, existsSync, readFileSync, statSync, truncateSync, unlinkSync } from 'fs';
|
||||
import { homedir, release, tmpdir } from 'os';
|
||||
import type { ProfilingSession, Target } from 'v8-inspect-profiler';
|
||||
|
@ -15,7 +15,7 @@ import { whenDeleted, writeFileSync } from 'vs/base/node/pfs';
|
|||
import { findFreePort } from 'vs/base/node/ports';
|
||||
import { watchFileContents } from 'vs/platform/files/node/watcher/nodejs/nodejsWatcherLib';
|
||||
import { NativeParsedArgs } from 'vs/platform/environment/common/argv';
|
||||
import { buildHelpMessage, buildVersionMessage, NATIVE_CLI_COMMANDS, OPTIONS } from 'vs/platform/environment/node/argv';
|
||||
import { buildHelpMessage, buildVersionMessage, OPTIONS } from 'vs/platform/environment/node/argv';
|
||||
import { addArg, parseCLIProcessArgv } from 'vs/platform/environment/node/argvHelper';
|
||||
import { getStdinFilePath, hasStdinWithoutTty, readFromStdin, stdinDataListener } from 'vs/platform/environment/node/stdin';
|
||||
import { createWaitMarkerFileSync } from 'vs/platform/environment/node/wait';
|
||||
|
@ -24,7 +24,6 @@ import { CancellationTokenSource } from 'vs/base/common/cancellation';
|
|||
import { isUNC, randomPath } from 'vs/base/common/extpath';
|
||||
import { Utils } from 'vs/platform/profiling/common/profiling';
|
||||
import { FileAccess } from 'vs/base/common/network';
|
||||
import { cwd } from 'vs/base/common/process';
|
||||
import { addUNCHostToAllowlist } from 'vs/base/node/unc';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
|
||||
|
@ -51,34 +50,34 @@ export async function main(argv: string[]): Promise<any> {
|
|||
return;
|
||||
}
|
||||
|
||||
for (const subcommand of NATIVE_CLI_COMMANDS) {
|
||||
if (args[subcommand]) {
|
||||
if (!product.tunnelApplicationName) {
|
||||
console.error(`'${subcommand}' command not supported in ${product.applicationName}`);
|
||||
return;
|
||||
}
|
||||
const tunnelArgs = argv.slice(argv.indexOf(subcommand) + 1); // all arguments behind `tunnel`
|
||||
return new Promise((resolve, reject) => {
|
||||
let tunnelProcess: ChildProcess;
|
||||
const stdio: StdioOptions = ['ignore', 'pipe', 'pipe'];
|
||||
if (process.env['VSCODE_DEV']) {
|
||||
tunnelProcess = spawn('cargo', ['run', '--', subcommand, ...tunnelArgs], { cwd: join(getAppRoot(), 'cli'), stdio });
|
||||
} else {
|
||||
const appPath = process.platform === 'darwin'
|
||||
// ./Contents/MacOS/Electron => ./Contents/Resources/app/bin/code-tunnel-insiders
|
||||
? join(dirname(dirname(process.execPath)), 'Resources', 'app')
|
||||
: dirname(process.execPath);
|
||||
const tunnelCommand = join(appPath, 'bin', `${product.tunnelApplicationName}${isWindows ? '.exe' : ''}`);
|
||||
tunnelProcess = spawn(tunnelCommand, [subcommand, ...tunnelArgs], { cwd: cwd(), stdio });
|
||||
}
|
||||
// for (const subcommand of NATIVE_CLI_COMMANDS) {
|
||||
// if (args[subcommand]) {
|
||||
// if (!product.tunnelApplicationName) {
|
||||
// console.error(`'${subcommand}' command not supported in ${product.applicationName}`);
|
||||
// return;
|
||||
// }
|
||||
// const tunnelArgs = argv.slice(argv.indexOf(subcommand) + 1); // all arguments behind `tunnel`
|
||||
// return new Promise((resolve, reject) => {
|
||||
// let tunnelProcess: ChildProcess;
|
||||
// const stdio: StdioOptions = ['ignore', 'pipe', 'pipe'];
|
||||
// if (process.env['VSCODE_DEV']) {
|
||||
// tunnelProcess = spawn('cargo', ['run', '--', subcommand, ...tunnelArgs], { cwd: join(getAppRoot(), 'cli'), stdio });
|
||||
// } else {
|
||||
// const appPath = process.platform === 'darwin'
|
||||
// // ./Contents/MacOS/Electron => ./Contents/Resources/app/bin/code-tunnel-insiders
|
||||
// ? join(dirname(dirname(process.execPath)), 'Resources', 'app')
|
||||
// : dirname(process.execPath);
|
||||
// const tunnelCommand = join(appPath, 'bin', `${product.tunnelApplicationName}${isWindows ? '.exe' : ''}`);
|
||||
// tunnelProcess = spawn(tunnelCommand, [subcommand, ...tunnelArgs], { cwd: cwd(), stdio });
|
||||
// }
|
||||
|
||||
tunnelProcess.stdout!.pipe(process.stdout);
|
||||
tunnelProcess.stderr!.pipe(process.stderr);
|
||||
tunnelProcess.on('exit', resolve);
|
||||
tunnelProcess.on('error', reject);
|
||||
});
|
||||
}
|
||||
}
|
||||
// tunnelProcess.stdout!.pipe(process.stdout);
|
||||
// tunnelProcess.stderr!.pipe(process.stderr);
|
||||
// tunnelProcess.on('exit', resolve);
|
||||
// tunnelProcess.on('error', reject);
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
|
||||
// Help
|
||||
if (args.help) {
|
||||
|
|
|
@ -14,15 +14,15 @@ export interface INativeCliOptions {
|
|||
*/
|
||||
export interface NativeParsedArgs {
|
||||
// subcommands
|
||||
tunnel?: INativeCliOptions & {
|
||||
user: {
|
||||
login: {
|
||||
'access-token'?: string;
|
||||
'provider'?: string;
|
||||
};
|
||||
};
|
||||
};
|
||||
'serve-web'?: INativeCliOptions;
|
||||
// tunnel?: INativeCliOptions & {
|
||||
// user: {
|
||||
// login: {
|
||||
// 'access-token'?: string;
|
||||
// 'provider'?: string;
|
||||
// };
|
||||
// };
|
||||
// };
|
||||
// 'serve-web'?: INativeCliOptions;
|
||||
_: string[];
|
||||
'folder-uri'?: string[]; // undefined or array of 1 or more
|
||||
'file-uri'?: string[]; // undefined or array of 1 or more
|
||||
|
|
|
@ -47,36 +47,36 @@ export type OptionDescriptions<T> = {
|
|||
export const NATIVE_CLI_COMMANDS = ['tunnel', 'serve-web'] as const;
|
||||
|
||||
export const OPTIONS: OptionDescriptions<Required<NativeParsedArgs>> = {
|
||||
'tunnel': {
|
||||
type: 'subcommand',
|
||||
description: 'Make the current machine accessible from vscode.dev or other machines through a secure tunnel',
|
||||
options: {
|
||||
'cli-data-dir': { type: 'string', args: 'dir', description: localize('cliDataDir', "Directory where CLI metadata should be stored.") },
|
||||
'disable-telemetry': { type: 'boolean' },
|
||||
'telemetry-level': { type: 'string' },
|
||||
user: {
|
||||
type: 'subcommand',
|
||||
options: {
|
||||
login: {
|
||||
type: 'subcommand',
|
||||
options: {
|
||||
provider: { type: 'string' },
|
||||
'access-token': { type: 'string' }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
'serve-web': {
|
||||
type: 'subcommand',
|
||||
description: 'Run a server that displays the editor UI in browsers.',
|
||||
options: {
|
||||
'cli-data-dir': { type: 'string', args: 'dir', description: localize('cliDataDir', "Directory where CLI metadata should be stored.") },
|
||||
'disable-telemetry': { type: 'boolean' },
|
||||
'telemetry-level': { type: 'string' },
|
||||
}
|
||||
},
|
||||
// 'tunnel': {
|
||||
// type: 'subcommand',
|
||||
// description: 'Make the current machine accessible from vscode.dev or other machines through a secure tunnel',
|
||||
// options: {
|
||||
// 'cli-data-dir': { type: 'string', args: 'dir', description: localize('cliDataDir', "Directory where CLI metadata should be stored.") },
|
||||
// 'disable-telemetry': { type: 'boolean' },
|
||||
// 'telemetry-level': { type: 'string' },
|
||||
// user: {
|
||||
// type: 'subcommand',
|
||||
// options: {
|
||||
// login: {
|
||||
// type: 'subcommand',
|
||||
// options: {
|
||||
// provider: { type: 'string' },
|
||||
// 'access-token': { type: 'string' }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
// 'serve-web': {
|
||||
// type: 'subcommand',
|
||||
// description: 'Run a server that displays the editor UI in browsers.',
|
||||
// options: {
|
||||
// 'cli-data-dir': { type: 'string', args: 'dir', description: localize('cliDataDir', "Directory where CLI metadata should be stored.") },
|
||||
// 'disable-telemetry': { type: 'boolean' },
|
||||
// 'telemetry-level': { type: 'string' },
|
||||
// }
|
||||
// },
|
||||
|
||||
'diff': { type: 'boolean', cat: 'o', alias: 'd', args: ['file', 'file'], description: localize('diff', "Compare two files with each other.") },
|
||||
'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.") },
|
||||
|
|
Loading…
Reference in New Issue