Craig Oates
4 years ago
1 changed files with 22 additions and 22 deletions
@ -1,22 +1,22 @@
|
||||
To use the "Help Section" feature, you will need to know about the four attributes it is built with. They are as follows, |
||||
|
||||
- **ListCommand**: When you attach this attribute to a command-method, that method will appear in the help section at run-time. You can, also, pass in `false`, as a parameter. This explicit declaration means the method will not appear at run-time. I use this option to turn things on an off without needing to rewrite the whole line every time. It helps with reducing temporary comment code, as well. |
||||
- **Parameters**: You can use this attribute to list out the parameters the end-user will need to pass into the command-method. The reason why you need to pass in a `string` to the attributes constructor is so you have flexibility. Some methods have parameter lists which are large and difficult to read. Because of this, it is in your end-user's interest for you to simplify it. I admit I could have programmed Console.Waterworks to figure it out for you. But, that would have taken that decision away from you. Whilst it is not perfect, I believe the string approach is the most practical solution. |
||||
- **Describe**: This attribute allows you to offer contextual information to the end-user. To use it, you pass in a `string` to the attribute's constructor. |
||||
- **Usage**: To help your end-users even more, you can provide them with an example of how to use your command-methods. To use this attribute, pass in a `string` to its constructor. |
||||
|
||||
To you get a sense of how they look in practice, please use the links below: |
||||
|
||||
- [ConsoleCommands.cs](https://git.abbether.net/craig.oates/Console.Waterworks/blob/master/Console.Waterworks/CW-Console/ConsoleCommands.cs) (part of CW-Console) |
||||
- [Wet Pancakes' ConsoleCommands.cs](https://git.abbether.net/craig.oates/Wet-Pancake/blob/master/WetPancakeCLI/ConsoleCommands.cs) (this uses Console.Waterworks in a slightly more advance manner) |
||||
- [Smouldering Beach Ball's ConsoleCommands.fs](https://git.abbether.net/craig.oates/Smouldering-Beach-Ball/blob/master/SmoulderingBeachBallCLI/ConsoleCommands.fs) (this uses the attributes with F#) |
||||
|
||||
You will only see these attributes decorating command-methods found in each project's "ConsoleCommands.cs" file (or ConsoleCommands.fs" file if you're using F#). |
||||
|
||||
```c# |
||||
// Copy and paste this in to ConsoleCommands file to speed up the typing. |
||||
[ListCommand()] // Passing in no parameters defaults to true. |
||||
[Description("")] |
||||
[Parameters("")] |
||||
[Usage("> ")] |
||||
``` |
||||
To use the "Help Section" feature, you will need to know about the four attributes it is built with. They are as follows, |
||||
|
||||
- **ListCommand**: When you attach this attribute to a command-method, that method will appear in the help section at run-time. You can, also, pass in `false`, as a parameter. This explicit declaration means the method will not appear at run-time. I use this option to turn things on an off without needing to rewrite the whole line every time. It helps with reducing temporary comment code, as well. |
||||
- **Parameters**: You can use this attribute to list out the parameters the end-user will need to pass into the command-method. The reason why you need to pass in a `string` to the attributes constructor is so you have flexibility. Some methods have parameter lists which are large and difficult to read. Because of this, it is in your end-user's interest for you to simplify it. I admit I could have programmed Console.Waterworks to figure it out for you. But, that would have taken that decision away from you. Whilst it is not perfect, I believe the string approach is the most practical solution. |
||||
- **Describe**: This attribute allows you to offer contextual information to the end-user. To use it, you pass in a `string` to the attribute's constructor. |
||||
- **Usage**: To help your end-users even more, you can provide them with an example of how to use your command-methods. To use this attribute, pass in a `string` to its constructor. |
||||
|
||||
To you get a sense of how they look in practice, please use the links below: |
||||
|
||||
- [ConsoleCommands.cs](https://git.abbether.net/craig.oates/Console.Waterworks/src/branch/master/Console.Waterworks/CW_Console/ConsoleCommands.cs) (part of CW-Console) |
||||
- [Wet Pancakes' ConsoleCommands.cs](https://git.abbether.net/craig.oates/Wet-Pancake/src/branch/master/WetPancakeCLI/ConsoleCommands.cs) (this uses Console.Waterworks in a slightly more advance manner) |
||||
- [Smouldering Beach Ball's ConsoleCommands.fs](https://git.abbether.net/craig.oates/Smouldering-Beach-Ball/src/branch/master/SmoulderingBeachBallCLI/ConsoleCommands.fs) (this uses the attributes with F#) |
||||
|
||||
You will only see these attributes decorating command-methods found in each project's "ConsoleCommands.cs" file (or ConsoleCommands.fs" file if you're using F#). |
||||
|
||||
```c# |
||||
// Copy and paste this in to ConsoleCommands file to speed up the typing. |
||||
[ListCommand()] // Passing in no parameters defaults to true. |
||||
[Description("")] |
||||
[Parameters("")] |
||||
[Usage("> ")] |
||||
``` |
||||
|
Loading…
Reference in new issue