Skip to content

Commit 95853e0

Browse files
committed
added documentation
1 parent 04239d5 commit 95853e0

File tree

3 files changed

+22
-11
lines changed

3 files changed

+22
-11
lines changed

documentation/Functions.md

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,18 +72,27 @@ createFile("cobigenexample/core/src/main/java/com/example/application/cobigenexa
7272
### changeFile
7373
#### parameter
7474
1. Path of the file to be changed (relative path to the workspace directory)
75-
2. Name of the placeholder
76-
3. Path of the file to get the content from or a string, that should be inserted.
75+
2.
76+
* path of the file to get the content from or a string, that should be inserted.
77+
* (Optional) Name of a placeholder
7778
#### example
78-
changeFile("cobigenexample/core/src/main/java/com/example/application/cobigenexample/customermanagement/dataaccess/api/CustomerEntity.java", "//PLACEHOLDER-GETTER-SETTER", {"file": "files/CustomerEntityFunction.java"})
79+
changeFile("cobigenexample/core/src/main/java/com/example/application/cobigenexample/customermanagement/dataaccess/api/CustomerEntity.java", { "file": "files/Placeholder.java", "placeholder": "private static final long serialVersionUID = 1L;" })
7980
#### details
80-
##### Name of the placeholder
81-
Naming Convention
82-
[Comment-Syntax]PLACEHOLDER-[DESCRIPTION]
8381
##### Path of the file to get the content from or a string, that should be inserted.
8482
If you want to add content from a file:
8583
{"file": "[path]"}
8684
If you want to add a string to a file:
8785
{"content": "[string]"}
86+
##### Name of the placeholder
87+
If you want to insert content into your code between two existing lines, take the previous line as your placeholder.
88+
89+
example:{...,"placeholder": "private int age;"}
90+
| Before | Content or File | After |
91+
| --- | --- | --- |
92+
|<p>private int age;<br><br>public String getFirstname() {<br>return firstname;<br>}<br></p>|<p>private int age;<br><br>private String company;<br>public String getCompany() {<br>return firstname;<br>}<br>public void setCompany(String company) {<br>this.company = company;<br>}</p>|<p>private int age;<br><br>private String company;<br>public String getCompany() {<br>return firstname;<br>}<br>public void setCompany(String company) {<br>this.company = company;<br><br>public String getFirstname() {<br>return firstname;<br>}<br></p>|
8893

89-
***
94+
A placeholder is optional. If you do not define a placeholder, the content in the existing file will be simply replaced by the new content.
95+
96+
Please try not to use custom placeholders. Keep in mind that you might want to build the project before changing the placeholders. Custom placeholders with a comment-syntax (e.g. "//PLACEHOLDER") will be disregarded by the console-environment and other custom placeholders might cause errors.
97+
98+
***

runners/katacoda/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,11 @@ export class Katacoda extends Runner {
166166
let content = "";
167167
let placeholder = "";
168168
let dataTarget = "replace";
169-
let changeDescr = "replace the content of "+ fileName +" with the following code.";
169+
let changeDescr = "Replace the content of "+ fileName +" with the following code.";
170170
if(command.parameters[1].placeholder){
171171
dataTarget = "insert";
172172
placeholder = command.parameters[1].placeholder;
173-
changeDescr = "insert after ' " + command.parameters[1].placeholder + " ' the following segment of code.";
173+
changeDescr = "Insert after ' " + command.parameters[1].placeholder + " ' the following segment of code.";
174174
}
175175
if(command.parameters[1].content){
176176
content = command.parameters[1].content;

runners/katacoda/templates/changeFile.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
<%= text; %>
22

3-
Go back to <%= fileName; %> and <%= changeDescr; %>
3+
Go back to the IDE and find the file <%= fileName; %>.
44

5-
Go to the IDE and click on 'Copy to Editor' to change it automatically.
5+
<%= changeDescr; %>
6+
7+
Click on 'Copy to Editor' to change it automatically.
68

79
<pre class="file" data-filename="<%= fileDir; %>" data-target="<%= dataTarget; %>" data-marker="<%= placeholder; %>">
810
<%= content; %>

0 commit comments

Comments
 (0)