|
2 | 2 | #### <center>Pyratron Command Parser Framework</center> |
3 | 3 | <center>[](https://travis-ci.org/Pyratron/Command-Parser)</center> |
4 | 4 |
|
5 | | -A simple, lightweight, but powerful command parsing library for use in games and other applications making use of user input commands. |
| 5 | +A powerful but simple command parsing library for use in games and other applications making use of user input commands. If you have created a game or application that has the need for command support, this library will easily let you create commands through a fluent interface, add help pages, optional parameters, grouped parameters, and more. |
6 | 6 |
|
7 | 7 | The [demo application](https://github.com/Pyratron/Command-Parser/archive/master.zip) contains a short tutorial and a variety of example commands to get you started. |
8 | 8 |
|
9 | | -Documentation will be created when the final library is released. |
| 9 | +##Documentation & Tutorials |
| 10 | +Documentation and tutorials are available on the [Pyratron website](https://www.pyratron.com/projects/command-parser). |
10 | 11 |
|
11 | | -###Example: |
12 | | - |
13 | | -```csharp |
14 | | -Parser = CommandParser.CreateNew().UsePrefix(string.Empty).OnError(OnParseError); |
15 | | - |
16 | | -Parser.AddCommand(Command |
17 | | - .Create("Ban User") //Friendly Name. |
18 | | - .AddAlias("ban") //Aliases. |
19 | | - .AddAlias("banuser") |
20 | | - .SetDescription("Bans a user from the server.") //Description. |
21 | | - //Action to be executed when command is ran with correct parameters. (Of course, can be method, lamba, delegate, etc) |
22 | | - .SetAction(OnBanExecuted) |
23 | | - //Precondition to be checked before executing the command. |
24 | | - .SetExecutePredicate(delegate |
25 | | - { |
26 | | - if (banned) |
27 | | - return "You are already banned!"; |
28 | | - return string.Empty; |
29 | | - }) |
30 | | - .AddArgument(Argument //Add an argument. |
31 | | - .Create("User"))); |
32 | | -``` |
33 | | - |
34 | | -... |
35 | | - |
36 | | -```csharp |
37 | | -private static void OnBanExecuted(Argument[] args) |
38 | | -{ |
39 | | - var user = args.FromName("user"); |
40 | | - Console.WriteLine("User {0} was banned!", user); |
41 | | - banned = true; |
42 | | -} |
43 | | - |
44 | | -private static void OnParseError(object sender, string message) |
45 | | -{ |
46 | | - Console.ForegroundColor = ConsoleColor.Red; |
47 | | - Console.WriteLine(message); |
48 | | - Console.ForegroundColor = ConsoleColor.Gray; |
49 | | -} |
50 | | -``` |
51 | | - |
52 | | -... |
53 | | - |
54 | | -```csharp |
55 | | -Parser.Parse("ban someone"); |
56 | | -``` |
| 12 | +###Example Application: |
| 13 | +[] |
0 commit comments