Skip to content

Commit 8ed2ee3

Browse files
author
Alessandro Sangalli
committed
feat: add name branch on start
1 parent e51f686 commit 8ed2ee3

1 file changed

Lines changed: 24 additions & 17 deletions

File tree

src/commands.ts

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,31 +16,38 @@ export function commandFactory(statusBarItems: MobStatusBarItem[]) {
1616
}
1717
});
1818
}),
19-
vscode.commands.registerCommand("mob-vscode-gui.start", () => {
20-
const timeInput = vscode.window.showInputBox({
19+
vscode.commands.registerCommand("mob-vscode-gui.start", async () => {
20+
const timeInput = await vscode.window.showInputBox({
2121
title: "How much time?",
2222
placeHolder: "Enter to ignore",
2323
validateInput: (input) => timerInputValidator(input),
2424
});
2525

26-
timeInput.then(async (input) => {
27-
let command = "mob start --include-uncommitted-changes";
28-
const expectedMessage = ["Happy collaborating!"];
29-
const timer = Number(input);
26+
const branchName = await vscode.window.showInputBox({
27+
title: "Branch name:",
28+
placeHolder: "Enter to ignore",
29+
});
3030

31-
if (timer > 0) {
32-
command += ` ${timer}`;
33-
}
31+
let command = "mob start --include-uncommitted-changes";
32+
const expectedMessage = ["Happy collaborating!"];
33+
const timer = Number(timeInput);
34+
35+
if (timer > 0) {
36+
command += ` ${timer}`;
37+
}
3438

35-
const startItem = statusBarItems.find((item) => item.id === "start");
36-
startItem?.startLoading();
39+
if (branchName) {
40+
command += ` -b ${branchName}`;
41+
}
3742

38-
try {
39-
await asyncExec(command, expectedMessage);
40-
} finally {
41-
startItem?.stopLoading();
42-
}
43-
});
43+
const startItem = statusBarItems.find((item) => item.id === "start");
44+
startItem?.startLoading();
45+
46+
try {
47+
await asyncExec(command, expectedMessage);
48+
} finally {
49+
startItem?.stopLoading();
50+
}
4451
}),
4552
vscode.commands.registerCommand("mob-vscode-gui.next", async () => {
4653
const command = "mob next";

0 commit comments

Comments
 (0)