Skip to content

Commit 20f6ec3

Browse files
committed
Update docs
1 parent e821b92 commit 20f6ec3

File tree

5 files changed

+89
-41
lines changed

5 files changed

+89
-41
lines changed

docs-src/commands.md

Lines changed: 42 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -157,30 +157,55 @@ Copyright © Ethan Hann 2017
157157
--secondary Clear the secondary queue.
158158
```
159159

160+
## Writing Output
161+
162+
The **InEngine.Core.AbstractCommand** class provides some helper functions to output text to the console:
163+
164+
```csharp
165+
IWrite Newline();
166+
IWrite Info(string val);
167+
IWrite Warning(string val);
168+
IWrite Error(string val);
169+
IWrite Line(string val);
170+
```
171+
172+
```csharp
173+
public CommandResult Run()
174+
{
175+
Info("Display some information");
176+
}
177+
```
178+
179+
Display an error message, use the Error method.
180+
181+
```csharp
182+
Error("Display some information");
183+
```
184+
185+
Display a warning message, use the Warning method.
186+
187+
```csharp
188+
Error("Display some information");
189+
```
190+
191+
Info, Error, and Warning messages are display in green, red, and yellow, respectively.
192+
If you want to display an uncolored line, use the Line method.
193+
Line("This is a plain line.");
160194

161195
## Logging
162196

163197
The **InEngine.Core.AbstractCommand** class provides a Logger property. It implements the **NLog.ILogger** interface.
164198

165199
```csharp
166-
using System;
167-
using InEngine.Core;
168-
169-
namespace MyCommandPlugin
200+
public CommandResult Run()
170201
{
171-
public class MyCommand : ICommand
172-
{
173-
public override CommandResult Run()
174-
{
175-
Logger.Trace("Sample trace message");
176-
Logger.Debug("Sample debug message");
177-
Logger.Info("Sample informational message");
178-
Logger.Warn("Sample warning message");
179-
Logger.Error("Sample error message");
180-
Logger.Fatal("Sample fatal error message");
181-
return new CommandResult(true);
182-
}
183-
}
202+
Logger.Trace("Sample trace message");
203+
Logger.Debug("Sample debug message");
204+
Logger.Info("Sample informational message");
205+
Logger.Warn("Sample warning message");
206+
Logger.Error("Sample error message");
207+
Logger.Fatal("Sample fatal error message");
208+
return new CommandResult(true);
184209
}
185210
```
186211

docs/commands/index.html

Lines changed: 35 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@
103103
<li><a href="#discover-command-plugins">Discover Command Plugins</a></li>
104104
<li><a href="#discover-commands-in-a-plugin">Discover Commands in a Plugin</a></li>
105105
<li><a href="#print-help-text-for-a-plugins-commands">Print Help Text for a Plugin's Commands</a></li>
106+
<li><a href="#writing-output">Writing Output</a></li>
106107
<li><a href="#logging">Logging</a></li>
107108
<li><a href="#progress-bar">Progress Bar</a></li>
108109
</ul>
@@ -235,26 +236,43 @@ <h2 id="print-help-text-for-a-plugins-commands">Print Help Text for a Plugin's C
235236
--secondary Clear the secondary queue.
236237
</code></pre>
237238

239+
<h2 id="writing-output">Writing Output</h2>
240+
<p>The <strong>InEngine.Core.AbstractCommand</strong> class provides some helper functions to output text to the console: </p>
241+
<pre><code class="csharp">IWrite Newline();
242+
IWrite Info(string val);
243+
IWrite Warning(string val);
244+
IWrite Error(string val);
245+
IWrite Line(string val);
246+
</code></pre>
247+
248+
<pre><code class="csharp">public CommandResult Run()
249+
{
250+
Info(&quot;Display some information&quot;);
251+
}
252+
</code></pre>
253+
254+
<p>Display an error message, use the Error method.</p>
255+
<pre><code class="csharp">Error(&quot;Display some information&quot;);
256+
</code></pre>
257+
258+
<p>Display a warning message, use the Warning method.</p>
259+
<pre><code class="csharp">Error(&quot;Display some information&quot;);
260+
</code></pre>
261+
262+
<p>Info, Error, and Warning messages are display in green, red, and yellow, respectively.
263+
If you want to display an uncolored line, use the Line method.
264+
Line("This is a plain line.");</p>
238265
<h2 id="logging">Logging</h2>
239266
<p>The <strong>InEngine.Core.AbstractCommand</strong> class provides a Logger property. It implements the <strong>NLog.ILogger</strong> interface.</p>
240-
<pre><code class="csharp">using System;
241-
using InEngine.Core;
242-
243-
namespace MyCommandPlugin
267+
<pre><code class="csharp">public CommandResult Run()
244268
{
245-
public class MyCommand : ICommand
246-
{
247-
public override CommandResult Run()
248-
{
249-
Logger.Trace(&quot;Sample trace message&quot;);
250-
Logger.Debug(&quot;Sample debug message&quot;);
251-
Logger.Info(&quot;Sample informational message&quot;);
252-
Logger.Warn(&quot;Sample warning message&quot;);
253-
Logger.Error(&quot;Sample error message&quot;);
254-
Logger.Fatal(&quot;Sample fatal error message&quot;);
255-
return new CommandResult(true);
256-
}
257-
}
269+
Logger.Trace(&quot;Sample trace message&quot;);
270+
Logger.Debug(&quot;Sample debug message&quot;);
271+
Logger.Info(&quot;Sample informational message&quot;);
272+
Logger.Warn(&quot;Sample warning message&quot;);
273+
Logger.Error(&quot;Sample error message&quot;);
274+
Logger.Fatal(&quot;Sample fatal error message&quot;);
275+
return new CommandResult(true);
258276
}
259277
</code></pre>
260278

docs/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,5 +146,5 @@ <h4 class="modal-title" id="exampleModalLabel">Search</h4>
146146

147147
<!--
148148
MkDocs version : 0.16.3
149-
Build Date UTC : 2017-11-21 14:09:52
149+
Build Date UTC : 2017-11-22 03:34:27
150150
-->

0 commit comments

Comments
 (0)