From 48fa22742855c341475031a7a0f8fc4b90c52bfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20G=C3=BCnther?= Date: Fri, 12 Feb 2021 14:44:17 +0100 Subject: [PATCH 1/3] added new parameter for nextKatacodaStep --- documentation/Functions.md | 1 + runners/katacoda/index.ts | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) 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..477f2b9d 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.currentDir, command.parameters[2]); + } + return null; } From f133de9b8c29f6b3627fa52ccb527255b2968ba2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20G=C3=BCnther?= Date: Fri, 12 Feb 2021 14:52:09 +0100 Subject: [PATCH 2/3] added new parameter for nextKatacodaStep --- runners/katacoda/index.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/runners/katacoda/index.ts b/runners/katacoda/index.ts index 477f2b9d..3a456952 100644 --- a/runners/katacoda/index.ts +++ b/runners/katacoda/index.ts @@ -337,7 +337,9 @@ export class Katacoda extends Runner { 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.currentDir, command.parameters[2]); + console.log(this.currentDir) + this.currentDir = path.join(this.getVariable(this.workspaceDirectory), command.parameters[2]); + console.log(this.currentDir) } return null; From 73582e4b1dcb9f35bd7e2dbc309cd29ef32de462 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20G=C3=BCnther?= Date: Fri, 12 Feb 2021 14:53:56 +0100 Subject: [PATCH 3/3] removed logs --- runners/katacoda/index.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/runners/katacoda/index.ts b/runners/katacoda/index.ts index 3a456952..c6b63012 100644 --- a/runners/katacoda/index.ts +++ b/runners/katacoda/index.ts @@ -337,9 +337,7 @@ export class Katacoda extends Runner { this.renderTemplate("nextKatacodaStep.md", this.outputPathTutorial + "step" + (this.stepsCount++) + ".md", { text: step.text, textAfter: step.textAfter, content: content }); if(command.parameters[2]) { - console.log(this.currentDir) this.currentDir = path.join(this.getVariable(this.workspaceDirectory), command.parameters[2]); - console.log(this.currentDir) } return null;