You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// For more information about the 'console' field, see https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md#console-terminal-window
<Description>MGR.CommandLineParser is a multi-command line parser. It uses System.ComponentModel.DataAnnotations to declare the commands.</Description>
Copy file name to clipboardExpand all lines: README.md
+26-22Lines changed: 26 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,25 +15,26 @@ _**Build status**_
15
15
MGR.CommandLineParser is a multi-command line parser. It uses [System.ComponentModel.DataAnnotations](http://msdn.microsoft.com/fr-fr/library/system.componentmodel.dataannotations.aspx) to declare and validate the commands.
16
16
17
17
# How to use it ?
18
-
You can find more docs [here](docs/index.md)
18
+
You can find **more docs [here](docs/index.md)**
19
19
20
-
I. **Install MGR.CommandLineParser**
20
+
**I. Install MGR.CommandLineParser**
21
21
22
22
MGR.CommandLineParser is available through [NuGet][nuget]:
23
23
24
24
PM> Install-Package MGR.CommandLineParser
25
25
26
-
II. **Declare your own commands**
26
+
**II. Declare your own commands**
27
27
28
-
After adding MGR.CommandLineParser to your project, you have to define your own commands:
28
+
After adding `MGR.CommandLineParser` to your project, you have to define your own commands:
29
29
30
30
* by implementing the interface `MGR.CommandLineParser.Command.ICommand`;
31
31
* by extending the abstract class `MGR.CommandLineParser.Command.CommandBase`.
32
32
33
33
To personnalize your commands, you add some properties to your class, and implement `Execute` (if you directly implement `ICommand`), or override `ExecuteCommand` (if you override `CommandBase`).
34
+
34
35
For example :
35
36
via `MGR.CommandLineParser.Command.ICommand`;
36
-
```
37
+
```c#
37
38
publicclassHelloWorldCommand : ICommand
38
39
{
39
40
[Display(ShortName="n", Description="The name to display")]
@@ -42,42 +43,42 @@ public class HelloWorldCommand : ICommand
In the first case, the first item in the `args` parameter must be the name of the command (the name of the type, minus the suffix `Command` if present).
103
105
In the other case, the name of the command should be omitted.
104
106
105
-
Depending on the value of `args`, the result will be (when not providing the type of the command to the `Parse` method):
107
+
Depending on the value of `args`, the result will be (when not providing the type of the command to the `Parse` method):
106
108
107
-
*`args` is null : return code is `CommandResultCode.NoArgs` (-100);
108
-
*`args` is an empty enumeration of string : return code is `CommandResultCode.NoCommandName` (-200) and the global help is printed to the console;
109
-
*`args` doesn't begin by `HelloWorld` or `Help` (the default help command) : return code is `CommandResultCode.NoCommandFound` (-300) and the global help is printed to the console;
110
-
*`args` is just `HelloWorld` : return code is `CommandResultCode.CommandParameterNotValid` (-400) and the help for the `HelloWorldCommand` is printed to the console;
111
-
*`args` is `HelloWorld -n Matthias` : return code is `CommandResultCode.Ok` (0) and `Hello world Matthias !` is printed to the console.
109
+
| Value of args | Result |
110
+
|------|--------|
111
+
|`null`|return code is `CommandResultCode.NoArgs` (-100)|
112
+
|empty enumeration of string|return code is `CommandResultCode.NoCommandName` (-200) and the global help is printed to the console|
113
+
|doesn't begin by `HelloWorld` or `Help` (the default help command)|return code is `CommandResultCode.NoCommandFound` (-300) and the global help is printed to the console|
114
+
|`HelloWorld`|return code is `CommandResultCode.CommandParameterNotValid` (-400) and the help for the `HelloWorldCommand` is printed to the console|
115
+
|`HelloWorld --name Matthias` or `HelloWorld -n Matthias`|return code is `CommandResultCode.Ok` (0) and `Hello world Matthias !` is printed to the console|
0 commit comments