Skip to content

Commit 013f04b

Browse files
committed
Merge branch 'master' of https://github.com/ivanpointer/CLI
2 parents 3976f5c + 1b90616 commit 013f04b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,19 @@ The things to note:
4848
## Using Delegate Functions
4949
The first approach allows for a simpler, slimmer solution and is best suited for smaller console apps that are just used to do just a few small tasks. Everything can be contained inside the `Main` method of `Program.cs`. Let's get right down to it:
5050

51-
![Delegate Example](http://i.imgur.com/sf19znU.png)
51+
![Delegate Example](http://i.imgur.com/vs7jDOY.png)
5252

53-
1. The first thing to look it is where we add an "Add" command. This is done by calling `CLI.Command(string commandName, Func<Arguments, int> command, string helpText = null)`. `commandName` defines the name of the command, `command` defines the function body of the command, and the optional `helpText` is used for the usage printout as text to describe the command. This first example shows this method being called without any help text. This is the simplest possible implementation of a command in the CLI.
53+
1. The first thing to look it is where we add an "Add" command. This is done by calling `CLIHandler.Command(string commandName, Func<Arguments, int> command, string helpText = null)`. `commandName` defines the name of the command, `command` defines the function body of the command, and the optional `helpText` is used for the usage printout as text to describe the command. This first example shows this method being called without any help text. This is the simplest possible implementation of a command in the CLI.
5454
2. The second command is basically the same as the first, except that in this case, the help text is provided.
55-
3. Lastly once we are done setting up the commands, we call `HandleMain` to have CLI handle the routing. The full signature of the `HandleMain` function is: `CLI.HandleMain(string[] args, char escapeCharacter = DefaultEscapeChar, bool ignoreCase = true)`. This example shows only the simples implementation: passing in the `string[] args`. The escape character and ignore case arguments are optional:
55+
3. Lastly once we are done setting up the commands, we call `HandleMain` to have CLI handle the routing. The full signature of the `HandleMain` function is: `CLIHandler.HandleMain(string[] args, char escapeCharacter = DefaultEscapeChar, bool ignoreCase = true)`. This example shows only the simples implementation: passing in the `string[] args`. The escape character and ignore case arguments are optional:
5656
1. **escapeCharacter**: The character that is used to signify a command name. The escape character comes before the command name. The default escape character is `/`.
5757
2. **ignoreCase**: Ignore case indicates whether or not to use case insensitive searches on the command and argument names. By default, ignore case is enabled, meaning command and argument names are not case sensitive.
5858

5959
## Using Classes and Attributes
6060
### A Simple Example
6161
Classes and attributes are a more advanced method of using the CLI utility. It is best suited for a larger or more "public facing" console application and allows for more encapsulation and modularizaiton. This approach also provides more methods for including more detailed information in the usage printout, making this more useful as a "shared" interface. Let's start by taking a look at the simplest implementation of a class decorated with the attributes:
6262

63-
![Command Class Example](http://i.imgur.com/qXMv8GK.png)
63+
![Command Class Example](http://i.imgur.com/0XpRLXa.png)
6464

6565
1. The first step is to implement the `ICLICommand` interface and decorate your class with the `Command` attribute. Without both, the CLI utility will ignore the class.
6666
2. Next, you will need to define your arguments. These are properties decorated with the `Argument` attribute. The types of the attributes are restricted: either a `ICollection<string>` or primitive types, such as `string`, `int` or any other type directly convertable from a `string` are supported.
@@ -69,7 +69,7 @@ Classes and attributes are a more advanced method of using the CLI utility. It
6969
### A Full Example
7070
The attributes allow for more more fine-tuned control of the commands. Let's jump into an example:
7171

72-
![Full Command Class Example](http://i.imgur.com/itpZp97.png)
72+
![Full Command Class Example](http://i.imgur.com/xDJifUa.png)
7373

7474
1. The `Command` attribute has three optional settings:
7575
1. **Description**: Provides a description for the command. This is used for the usage printout to describe the command. This walkthrough shows an example of the usage printout later.

0 commit comments

Comments
 (0)