diff --git a/src/commands/changeFile/openAndRun.command.ts b/src/commands/changeFile/openAndRun.command.ts index b729276..f56912c 100644 --- a/src/commands/changeFile/openAndRun.command.ts +++ b/src/commands/changeFile/openAndRun.command.ts @@ -35,6 +35,17 @@ export const openAndRunCommand = vscode.commands.registerCommand( if (commands.length === 0) return; + const betweenMessage = + 'Please enter timer (ms) for delay between each command'; + + const timer = await vscode.window.showInputBox({ + title: betweenMessage, + placeHolder: betweenMessage, + value: '0', + }); + + if (Number.isNaN(+timer!) || timer === null) return; + await vscode.window.withProgress( { cancellable: false, @@ -46,7 +57,7 @@ export const openAndRunCommand = vscode.commands.registerCommand( return; }); - await new ChangeFileHandler(dirPath).openAndRun(commands); + await new ChangeFileHandler(dirPath).openAndRun(commands, +timer!); }, ); } catch (error: any) { diff --git a/src/handlers/changeFile.handler.ts b/src/handlers/changeFile.handler.ts index 2c6a9a8..295b89a 100644 --- a/src/handlers/changeFile.handler.ts +++ b/src/handlers/changeFile.handler.ts @@ -34,9 +34,9 @@ export class ChangeFileHandler { /** * open that file and run each commands one by one */ - async openAndRun(commands: string[]) { + async openAndRun(commands: string[], timer = 300) { for (const fromUrl of this.fileTree) { - await new RunCommandHandler(fromUrl).openAndRun(commands); + await new RunCommandHandler(fromUrl).openAndRun(commands, timer); } }