Creating shell service commands is fairly simple; it consists of the following:
Those properties declare the commands to be exposed and the scope in which they belong.
Additionally, a set of annotations can be attached to the proxy methods and their parameters to provide further descriptive information. This information would be used when listing the commands or when constructing their help
output.
There are two service properties used when registering commands:
Here's a diagram that describes the previous setup to our case:
When a service is registered with those dictionary properties, the Gogo Shell Runtime picks them up and constructs command entries for them. Those entries map to the method, or methods, with the same name.
It is possible to have more than one method that matches the function name (with different signatures). The Gogo components will find the best match, based on the command input by the user.
The BookshelfServiceProxy
is the service that we will register; it will hold the methods that provide the commands. We will first take an end-to-end path with the search
commands and then take it again when implementing the add
command.