Add view output action

Signed-off-by: Sanjula Ganepola <sanjulagane@gmail.com>
This commit is contained in:
Sanjula Ganepola
2024-10-17 21:52:17 -04:00
parent f215c03697
commit b274529707
3 changed files with 34 additions and 3 deletions

View File

@@ -240,6 +240,14 @@ export class Act {
const writeEmitter = new EventEmitter<string>();
const closeEmitter = new EventEmitter<number>();
writeEmitter.event(data => {
if (!this.workspaceHistory[commandArgs.workspaceFolder.uri.fsPath][historyIndex].output) {
this.workspaceHistory[commandArgs.workspaceFolder.uri.fsPath][historyIndex].output = data;
} else {
this.workspaceHistory[commandArgs.workspaceFolder.uri.fsPath][historyIndex].output += data;
}
});
const exec = child_process.spawn(command, { cwd: commandArgs.workspaceFolder.uri.fsPath, shell: env.shell });
const handleIO = (data: any) => {
const lines: string[] = data.toString().split('\n').filter((line: string) => line != '');
@@ -354,6 +362,10 @@ export class Act {
}
}
async viewOutput(history: History) {
await workspace.openTextDocument({ content: history.output });
}
async stop(history: History) {
history.taskExecution?.terminate();
historyTreeDataProvider.refresh();

View File

@@ -21,6 +21,9 @@ export default class HistoryTreeDataProvider implements TreeDataProvider<GithubL
commands.registerCommand('githubLocalActions.refreshHistory', async () => {
this.refresh();
}),
commands.registerCommand('githubLocalActions.viewOutput', async (historyTreeItem: HistoryTreeItem) => {
await act.viewOutput(historyTreeItem.history);
}),
commands.registerCommand('githubLocalActions.restart', async (historyTreeItem: HistoryTreeItem) => {
await act.runCommand(historyTreeItem.history.commandArgs);
}),