Skip to content

Commit cf4f17d

Browse files
Param now a string array
1 parent cfa8eca commit cf4f17d

File tree

4 files changed

+12
-11
lines changed

4 files changed

+12
-11
lines changed

documentation/Functions.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -253,13 +253,13 @@ adaptTemplatesCobiGen()
253253
#### parameter
254254
1. Name of the Project.
255255
2. Path to where the Project should be created (relative to workspace). Folder should exist.
256-
3. (Optional) Optional parameters, according to https://angular.io/cli/new .
256+
3. (Optional) String array of parameters, according to https://angular.io/cli/new.
257257
#### example
258-
createDevon4ngProject("exampleAngularProject")
258+
createDevon4ngProject("exampleAngularProject", "")
259259
Will create the angular project to the current workspace with the name exampleAngularProject.
260260

261-
createDevon4ngProject("exampleAngularProject", "projects")
262-
Will create the angular project to the directory projects within the current workspace.
261+
createDevon4ngProject("exampleAngularProject", "projects", ["--verbose"])
262+
Will create the angular project to the directory projects within the current workspace and adds more details to output logging.
263263

264264
#### Details
265265
This command also works if the devonfw IDE is not installed, but then you have to make sure that the Angular cli is installed.

runners/console/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -352,10 +352,10 @@ export class Console extends Runner {
352352
result.returnCode = 0;
353353

354354
let projectDir = path.join(this.getVariable(this.workspaceDirectory), runCommand.command.parameters[1]);
355-
let optional = runCommand.command.parameters.length > 2 ? (" " + runCommand.command.parameters[2]) : "";
355+
let params = runCommand.command.parameters.length > 2 && (runCommand.command.parameters[2] instanceof Array) ? (" " + runCommand.command.parameters[2].join(" ")) : "";
356356
this.getVariable(this.useDevonCommand)
357-
? this.executeDevonCommandSync("ng create " + runCommand.command.parameters[0] + optional, projectDir, result)
358-
: this.executeCommandSync("ng new " + runCommand.command.parameters[0] + optional, projectDir, result);
357+
? this.executeDevonCommandSync("ng create " + runCommand.command.parameters[0] + params, projectDir, result)
358+
: this.executeCommandSync("ng new " + runCommand.command.parameters[0] + params, projectDir, result);
359359

360360
return result;
361361
}

runners/katacoda/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,10 +333,11 @@ export class Katacoda extends Runner {
333333

334334
runCreateDevon4ngProject(runCommand: RunCommand): RunResult {
335335
let cdCommand = this.changeCurrentDir(path.join(this.getVariable(this.workspaceDirectory), runCommand.command.parameters[1]));
336-
336+
let params = runCommand.command.parameters.length > 2 && (runCommand.command.parameters[2] instanceof Array) ? runCommand.command.parameters[2].join(" ") : "";
337+
337338
this.pushStep(runCommand, "Create Angular Project", "step" + this.getStepsCount(runCommand) + ".md");
338339

339-
this.renderTemplate("createDevon4ngProject.md", this.outputPathTutorial + "step" + this.stepsCount + ".md", { text: runCommand.text, textAfter: runCommand.textAfter, cdCommand: cdCommand, projectName: runCommand.command.parameters[0], optional: runCommand.command.parameters[2], useDevonCommand: this.getVariable(this.useDevonCommand) });
340+
this.renderTemplate("createDevon4ngProject.md", this.outputPathTutorial + "step" + this.stepsCount + ".md", { text: runCommand.text, textAfter: runCommand.textAfter, cdCommand: cdCommand, projectName: runCommand.command.parameters[0], params: params, useDevonCommand: this.getVariable(this.useDevonCommand) });
340341
return null;
341342
}
342343

runners/katacoda/templates/createDevon4ngProject.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
<% if(useDevonCommand){ %>
66
Use the ng create command to create a new Angular Project with the name <%= projectName; %>.
7-
`devon ng create <%= projectName; %><% if(optional){ %> <%= optional; %><% } %>`{{execute T1}}
7+
`devon ng create <%= projectName; %><% if(params){ %> <%= params; %><% } %>`{{execute T1}}
88
<% } else { %>
99
Use the ng new command to create a new Angular Project with the name <%= projectName; %>.
10-
`ng new <%= projectName; %><% if(optional){ %> <%= optional; %><% } %>`{{execute T1}}
10+
`ng new <%= projectName; %><% if(params){ %> <%= params; %><% } %>`{{execute T1}}
1111
<% } %>
1212

1313
<%= textAfter; %>

0 commit comments

Comments
 (0)