Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Add a button to reset the PROS conductor file #224

Merged
merged 5 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@
"command": "pros.infoProject",
"title": "PROS: Project Information"
},
{
"command": "pros.resetConductor",
"title": "PROS: Reset Conductor"
},
{
"command": "pros.welcome",
"title": "PROS: Welcome"
Expand Down
1 change: 1 addition & 0 deletions src/commands/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
21 changes: 21 additions & 0 deletions src/commands/reset-conductor.ts
Original file line number Diff line number Diff line change
@@ -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();
Jackman3323 marked this conversation as resolved.
Show resolved Hide resolved
} catch (err: any) {
await vscode.window.showErrorMessage(err.message);
}
};
2 changes: 2 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import {
setRobotName,
runVision,
getCurrentKernelOkapiVersion,
resetConductor,
} from "./commands";
import { ProsProjectEditorProvider } from "./views/editor";
import { Analytics } from "./ga";
Expand Down Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/views/tree-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export class TreeDataProvider implements vscode.TreeDataProvider<TreeItem> {
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", [
Expand Down
Loading