diff --git a/package.json b/package.json index bcc0f10..55e97dc 100644 --- a/package.json +++ b/package.json @@ -165,6 +165,10 @@ "command": "pros.infoProject", "title": "PROS: Project Information" }, + { + "command": "pros.resetConductor", + "title": "PROS: Reset Conductor" + }, { "command": "pros.welcome", "title": "PROS: Welcome" diff --git a/src/commands/index.ts b/src/commands/index.ts index 0d40187..d746718 100644 --- a/src/commands/index.ts +++ b/src/commands/index.ts @@ -16,3 +16,4 @@ export * from "./set-team-number"; export * from "./set-robot-name"; export * from "./runvision"; export * from "./info-project"; +export * from "./reset-conductor"; diff --git a/src/commands/reset-conductor.ts b/src/commands/reset-conductor.ts new file mode 100644 index 0000000..ad000b7 --- /dev/null +++ b/src/commands/reset-conductor.ts @@ -0,0 +1,21 @@ +import * as vscode from "vscode"; +import { BaseCommand, BaseCommandOptions } from "./base-command"; + +export const resetConductor = async () => { + const resetConductorCommandOptions: BaseCommandOptions = { + command: "pros", + args: ["c", "reset"], //--force not needed: Ben's base-commands class auto-handles warning + confirmation. + message: "Resetting Conductor", + requiresProsProject: false, + successMessage: + "Conductor Reset Successfully. Any templates and/or depots previously cached will need to be re-fetched.", + }; + const resetConductorCommand: BaseCommand = new BaseCommand( + resetConductorCommandOptions + ); + try { + await resetConductorCommand.runCommand(); + } catch (err: any) { + await vscode.window.showErrorMessage(err.message); + } +}; diff --git a/src/extension.ts b/src/extension.ts index e919114..d28e2dd 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -30,6 +30,7 @@ import { setRobotName, runVision, getCurrentKernelOkapiVersion, + resetConductor, } from "./commands"; import { ProsProjectEditorProvider } from "./views/editor"; import { Analytics } from "./ga"; @@ -229,6 +230,7 @@ export async function activate(context: vscode.ExtensionContext) { setupCommandBlocker("pros.upgrade", upgradeProject); setupCommandBlocker("pros.new", createNewProject); setupCommandBlocker("pros.infoProject", infoProject); + setupCommandBlocker("pros.resetConductor", resetConductor); // Beta commands (notice the fourth argument is set to true for these) setupCommandBlocker("pros.installVision", installVision, context, true); diff --git a/src/views/tree-view.ts b/src/views/tree-view.ts index e0fd47a..47774a6 100644 --- a/src/views/tree-view.ts +++ b/src/views/tree-view.ts @@ -36,6 +36,7 @@ export class TreeDataProvider implements vscode.TreeDataProvider { new TreeItem("Upgrade Project", undefined, "pros.upgrade"), new TreeItem("Create Project", undefined, "pros.new"), new TreeItem("Project/Template Info", undefined, "pros.infoProject"), + new TreeItem("Reset Conductor", undefined, "pros.resetConductor"), // open branchline will go here in the future ]), new TreeItem("Manage Installations", [