Using commands, the end user can interact with the snap-in through any defined surface. Under the commands section of the snap-in manifest, commands are defined. For example, we can define a command called close that moves an issue and its children to the completed state as follows:
1 commands:2 - name: close3 namespace: devrev4 description: Closes the issue and all of its children issues.5 surfaces:6 - surface: discussions7 object_types:8 - issue9 usage_hint: "[text]"10 function: close_issue
The description of the command's fields is as follows:
- name: This is the name of the command used by the user to trigger it.
- namespace: it's used to distinguish commands installed from different snap-ins with the same name. Ensure the namespace is appropriate for your snap-in.
- description: Displayed when a list of commands is displayed to the user.
- usage_hint: A hint showing how to pass parameters to a command.
- function: When the command is executed, this function will be triggered by the snap-in.
- surfaces: The surface where the command is enabled. More details in below table: