diff --git a/documentation/Functions.md b/documentation/Functions.md index 87a18bd3..631a541d 100644 --- a/documentation/Functions.md +++ b/documentation/Functions.md @@ -203,6 +203,7 @@ path: The URL path on which is checked if the server is running #### parameter 1. The title of the step. 2. An array of json objects with files, content, or images to be rendered within the katacoda step. +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. #### example nextKatacodaStep("Step title", [{ "file": "files/description.md" }, { "content": "This is just plain content." }, { "image": "files/image.png" }]) diff --git a/runners/katacoda/index.ts b/runners/katacoda/index.ts index 050273fe..c6b63012 100644 --- a/runners/katacoda/index.ts +++ b/runners/katacoda/index.ts @@ -303,7 +303,7 @@ export class Katacoda extends Runner { runCreateFolder(step: Step, command: Command): RunResult { let folderPath = new DirUtils().getCdParam(this.currentDir, path.join(this.getVariable(this.workspaceDirectory), command.parameters[0])); - + this.steps.push({ "title": "Create a new folder", "text": "step" + this.stepsCount + ".md" @@ -335,6 +335,11 @@ export class Katacoda extends Runner { "text": "step" + this.stepsCount + ".md" }); this.renderTemplate("nextKatacodaStep.md", this.outputPathTutorial + "step" + (this.stepsCount++) + ".md", { text: step.text, textAfter: step.textAfter, content: content }); + + if(command.parameters[2]) { + this.currentDir = path.join(this.getVariable(this.workspaceDirectory), command.parameters[2]); + } + return null; }