mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-23 18:19:12 +01:00
extensionsManagement for remote CLI
This commit is contained in:
@@ -39,7 +39,15 @@ export interface RunCommandPipeArgs {
|
||||
args: any[];
|
||||
}
|
||||
|
||||
export type PipeCommand = OpenCommandPipeArgs | StatusPipeArgs | RunCommandPipeArgs | OpenExternalCommandPipeArgs;
|
||||
export interface ExtensionManagementPipeArgs {
|
||||
type: 'extensionManagement';
|
||||
list?: { showVersions?: boolean, category?: string; };
|
||||
install?: string[];
|
||||
uninstall?: string[];
|
||||
force?: boolean;
|
||||
}
|
||||
|
||||
export type PipeCommand = OpenCommandPipeArgs | StatusPipeArgs | RunCommandPipeArgs | OpenExternalCommandPipeArgs | ExtensionManagementPipeArgs;
|
||||
|
||||
export interface ICommandsExecuter {
|
||||
executeCommand<T>(id: string, ...args: any[]): Promise<T>;
|
||||
@@ -95,6 +103,10 @@ export class CLIServerBase {
|
||||
this.runCommand(data, res)
|
||||
.catch(this.logService.error);
|
||||
break;
|
||||
case 'extensionManagement':
|
||||
this.manageExtensions(data, res)
|
||||
.catch(this.logService.error);
|
||||
break;
|
||||
default:
|
||||
res.writeHead(404);
|
||||
res.write(`Unknown message type: ${data.type}`, err => {
|
||||
@@ -143,14 +155,27 @@ export class CLIServerBase {
|
||||
res.end();
|
||||
}
|
||||
|
||||
private openExternal(data: OpenExternalCommandPipeArgs, res: http.ServerResponse) {
|
||||
private async openExternal(data: OpenExternalCommandPipeArgs, res: http.ServerResponse) {
|
||||
for (const uri of data.uris) {
|
||||
this._commands.executeCommand('_workbench.openExternal', URI.parse(uri), { allowTunneling: true });
|
||||
await this._commands.executeCommand('_cli.openExternal', URI.parse(uri), { allowTunneling: true });
|
||||
}
|
||||
res.writeHead(200);
|
||||
res.end();
|
||||
}
|
||||
|
||||
private async manageExtensions(data: ExtensionManagementPipeArgs, res: http.ServerResponse) {
|
||||
console.log('server: manageExtensions');
|
||||
try {
|
||||
const output = await this._commands.executeCommand('_cli.manageExtensions', data, { allowTunneling: true });
|
||||
res.writeHead(200);
|
||||
res.write(output);
|
||||
} catch (e) {
|
||||
res.writeHead(500);
|
||||
res.write(toString());
|
||||
}
|
||||
res.end();
|
||||
}
|
||||
|
||||
private async getStatus(data: StatusPipeArgs, res: http.ServerResponse) {
|
||||
try {
|
||||
const status = await this._commands.executeCommand('_issues.getSystemStatus');
|
||||
|
||||
Reference in New Issue
Block a user