Skip to content

Commit 3475f4b

Browse files
committed
Update docs
1 parent 45194cb commit 3475f4b

File tree

1 file changed

+69
-70
lines changed

1 file changed

+69
-70
lines changed

docs-src/commands.md

Lines changed: 69 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,75 @@ Run your command:
105105
inengine.exe -pMyCommandPlugin my-command
106106
```
107107

108+
### Writing Output
109+
110+
The **InEngine.Core.AbstractCommand** class provides some helper functions to output text to the console, for example:
111+
112+
```c#
113+
public override void Run()
114+
{
115+
Line("Display some information");
116+
}
117+
```
118+
119+
All of these commands append a newline to the end of the specified text:
120+
121+
```c#
122+
Line("This is some text"); // Text color is white
123+
Info("Something good happened"); // Text color is green
124+
Warning("Something not so good happened"); // Text color is yellow
125+
Error("Something bad happened"); // Text color is red
126+
```
127+
128+
These commands are similar, but they do not append a newline:
129+
130+
```c#
131+
Text("This is some text"); // Text color is white
132+
InfoText("Something good happened"); // Text color is green
133+
WarningText("Something not so good happened"); // Text color is yellow
134+
ErrorText("Something bad happened"); // Text color is red
135+
```
136+
137+
You can also display newlines:
138+
139+
```c#
140+
Newline(); // 1 newline
141+
Newline(5); // 5 newlines
142+
Newline(10); // 10 newlines
143+
```
144+
145+
The methods can be chained together:
146+
147+
```c#
148+
InfoText("You have this many things: ")
149+
.Line("23")
150+
.NewLine(2)
151+
.InfoText("You have this many other things: ")
152+
.Line("34")
153+
.NewLine(2);
154+
```
155+
156+
### Progress Bar
157+
158+
The **InEngine.Core.AbstractCommand** class provides a ProgressBar property to show command progress in a terminal.
159+
This is how it is used:
160+
161+
```c#
162+
public override void Run()
163+
{
164+
// Define the ticks (aka steps) for the command...
165+
var maxTicks = 100000;
166+
SetProgressBarMaxTicks(maxTicks);
167+
168+
// Do some work...
169+
for (var i = 0; i <= maxTicks;i++)
170+
{
171+
// Update the command's progress
172+
UpdateProgress(i);
173+
}
174+
}
175+
```
176+
108177
### Executing Arbitrary Processes
109178

110179
It isn't necessary to create C# classes to utilize InEngine.NET.
@@ -208,54 +277,6 @@ Copyright © 2017 Ethan Hann
208277
queue.
209278
```
210279

211-
## Writing Output
212-
213-
The **InEngine.Core.AbstractCommand** class provides some helper functions to output text to the console, for example:
214-
215-
```c#
216-
public override void Run()
217-
{
218-
Line("Display some information");
219-
}
220-
```
221-
222-
All of these commands append a newline to the end of the specified text:
223-
224-
```c#
225-
Line("This is some text"); // Text color is white
226-
Info("Something good happened"); // Text color is green
227-
Warning("Something not so good happened"); // Text color is yellow
228-
Error("Something bad happened"); // Text color is red
229-
```
230-
231-
These commands are similar, but they do not append a newline:
232-
233-
```c#
234-
Text("This is some text"); // Text color is white
235-
InfoText("Something good happened"); // Text color is green
236-
WarningText("Something not so good happened"); // Text color is yellow
237-
ErrorText("Something bad happened"); // Text color is red
238-
```
239-
240-
You can also display newlines:
241-
242-
```c#
243-
Newline(); // 1 newline
244-
Newline(5); // 5 newlines
245-
Newline(10); // 10 newlines
246-
```
247-
248-
The methods can be chained together:
249-
250-
```c#
251-
InfoText("You have this many things: ")
252-
.Line("23")
253-
.NewLine(2)
254-
.InfoText("You have this many other things: ")
255-
.Line("34")
256-
.NewLine(2);
257-
```
258-
259280
## Logging
260281

261282
Any exceptions thrown by a command will be logged provided NLog is configured to record errors.
@@ -275,25 +296,3 @@ The [NLog configuration](https://github.com/NLog/NLog/wiki/Tutorial#configuratio
275296
</rules>
276297
</nlog>
277298
```
278-
279-
## Progress Bar
280-
281-
The **InEngine.Core.AbstractCommand** class provides a ProgressBar property to show command progress in a terminal.
282-
This is how it is used:
283-
284-
```c#
285-
public override void Run()
286-
{
287-
// Define the ticks (aka steps) for the command...
288-
var maxTicks = 100000;
289-
SetProgressBarMaxTicks(maxTicks);
290-
291-
// Do some work...
292-
for (var i = 0; i <= maxTicks;i++)
293-
{
294-
// Update the command's progress
295-
UpdateProgress(i);
296-
}
297-
}
298-
```
299-

0 commit comments

Comments
 (0)