3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-27 13:09:23 +01:00

services-api: mention command alias support in 2.0-alpha1+

This commit is contained in:
James Lu 2018-07-02 00:44:45 -07:00
parent 75b0ae6054
commit b2e85fa385

View File

@ -85,4 +85,17 @@ Commands for service bots and commands for the main PyLink bot have two main dif
### Featured commands ### Featured commands
Commands for service bots can also be marked as *featured*, which shows it with its command arguments in the default `LIST` command. To mark a command as featured, use `myservice.add_cmd(cmdfunc, 'cmdname', featured=True)`. Commands for service bots can also be marked as *featured*, which shows it with its command arguments in the default `LIST` command. To mark a command as featured, enable the `featured` option when binding it: e.g. `myservice.add_cmd(cmdfunc, featured=True)`.
### Command aliases
Since PyLink 2.0-alpha1, `ServiceBot.add_cmd(...)` and `utils.add_cmd(...)` support assigning aliases to a command by defining the `aliases` argument. Command aliases do not show in `LIST`, allowing command listings to be much cleaner. Instead, they are only mentioned when `HELP` is called on an alias command name or its parent.
Example:
```python
myservice.add_cmd(functwo, aliases=('abc',))
myservice.add_cmd(somefunc, aliases=('command1', 'command2'))
```
Note: use `(variable,)` to define a one length tuple to [prevent it from being parsed as a single string](https://wiki.python.org/moin/TupleSyntax).