Skip to content

Commit 023c01e

Browse files
authored
Merge pull request #119 from GuentherJulian/feature/nextKatacodaStepEnhancement
feature/nextKatacodaStepEnhancement
2 parents bf68d8a + 73582e4 commit 023c01e

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

documentation/Functions.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ path: The URL path on which is checked if the server is running
203203
#### parameter
204204
1. The title of the step.
205205
2. An array of json objects with files, content, or images to be rendered within the katacoda step.
206+
3. (Optional) Path to the current directory where the user is located (relative to the workspace directory). Only needed if the directory is changed within this step.
206207
#### example
207208
nextKatacodaStep("Step title", [{ "file": "files/description.md" }, { "content": "This is just plain content." }, { "image": "files/image.png" }])
208209

runners/katacoda/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ export class Katacoda extends Runner {
303303

304304
runCreateFolder(step: Step, command: Command): RunResult {
305305
let folderPath = new DirUtils().getCdParam(this.currentDir, path.join(this.getVariable(this.workspaceDirectory), command.parameters[0]));
306-
306+
307307
this.steps.push({
308308
"title": "Create a new folder",
309309
"text": "step" + this.stepsCount + ".md"
@@ -335,6 +335,11 @@ export class Katacoda extends Runner {
335335
"text": "step" + this.stepsCount + ".md"
336336
});
337337
this.renderTemplate("nextKatacodaStep.md", this.outputPathTutorial + "step" + (this.stepsCount++) + ".md", { text: step.text, textAfter: step.textAfter, content: content });
338+
339+
if(command.parameters[2]) {
340+
this.currentDir = path.join(this.getVariable(this.workspaceDirectory), command.parameters[2]);
341+
}
342+
338343
return null;
339344
}
340345

0 commit comments

Comments
 (0)