create The Help Attributes.

master
Craig Oates 5 years ago
parent
commit
1c811a9b9c
  1. 14
      The-Help-Attributes.md

14
The-Help-Attributes.md

@ -0,0 +1,14 @@
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 a false Boolean, 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://gitlab.com/craig.oates/Console.Waterworks/blob/master/Console.Waterworks/CW_Console/ConsoleCommands.cs) (part of CW_Console)
- [Wet Pancakes' ConsoleCommands.cs](https://gitlab.com/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://gitlab.com/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#).
Loading…
Cancel
Save