diff --git a/package.json b/package.json index dec49548..5a681895 100644 --- a/package.json +++ b/package.json @@ -91,7 +91,8 @@ "onStartupFinished", "workspaceContains:**/**.portalconfig", "onDebug", - "onFileSystem:powerplatform-vfs" + "onFileSystem:powerplatform-vfs", + "onUri" ], "capabilities": { "untrustedWorkspaces": { diff --git a/src/client/extension.ts b/src/client/extension.ts index 9f0c5492..34ba5f2d 100644 --- a/src/client/extension.ts +++ b/src/client/extension.ts @@ -84,6 +84,29 @@ export async function activate( vscode.workspace.onDidOpenTextDocument(didOpenTextDocument); vscode.workspace.textDocuments.forEach(didOpenTextDocument); + vscode.window.registerUriHandler({ + handleUri(uri:vscode.Uri) { + const params = uri.query.split('&'); //'vscode://microsoft-IsvExpTools.powerplatform-vscode?org&siteid' + let org = ''; + let siteid = ''; + params.forEach(param => { + const pair = param.split('='); + switch (pair[0]){ + case 'org':{ + org = pair[1]; + break; + } + case 'siteid':{ + siteid = pair[1]; + break; + } + } + }); + vscode.commands.executeCommand("pacCLI.pacAuthCreate", org); + vscode.commands.executeCommand("pacCLI.pacPaportalDownload", siteid); + } + }) + // portal web view panel _context.subscriptions.push( vscode.commands.registerCommand( diff --git a/src/client/lib/PacTerminal.ts b/src/client/lib/PacTerminal.ts index a8c49361..1d84e465 100644 --- a/src/client/lib/PacTerminal.ts +++ b/src/client/lib/PacTerminal.ts @@ -44,7 +44,9 @@ export class PacTerminal implements vscode.Disposable { vscode.commands.registerCommand('pacCLI.pacAuthHelp', () => PacTerminal.getTerminal().sendText("pac auth help")), vscode.commands.registerCommand('pacCLI.pacPackageHelp', () => PacTerminal.getTerminal().sendText("pac package help")), vscode.commands.registerCommand('pacCLI.pacPcfHelp', () => PacTerminal.getTerminal().sendText("pac pcf help")), - vscode.commands.registerCommand('pacCLI.pacSolutionHelp', () => PacTerminal.getTerminal().sendText("pac solution help"))); + vscode.commands.registerCommand('pacCLI.pacSolutionHelp', () => PacTerminal.getTerminal().sendText("pac solution help")), + vscode.commands.registerCommand('pacCLI.pacAuthCreate', (orgUrl) => PacTerminal.getTerminal().sendText("pac auth create -u " + orgUrl)), + vscode.commands.registerCommand('pacCLI.pacPaportalDownload', (websiteId) => PacTerminal.getTerminal().sendText(`pac paportal download -id ${websiteId} -p . -o`))); this._cmdDisposables.push(vscode.commands.registerCommand(`pacCLI.enableTelemetry`, async () => { const result = await this._pacWrapper.enableTelemetry();