Created ide.read (markdown)

ni-richard 2019-09-11 17:12:47 +02:00
parent a5cda60c43
commit e2d0e538ac

55
ide.read.md Normal file

@ -0,0 +1,55 @@
### Request
* **Description**: Attempts to fetch the contents of a file, then loads it in the IDE. You can also define new patterns for allowed files.
* **Subscribers**: [IdeHandler](https://github.com/avatao-content/baseimage-tutorial-framework/wiki/IdeHandler)
```json
{
"key": "ide.read",
"intent": "control",
"scope": "zmq"
}
```
| Parameter | Type | Required | Description |
| ------------ |:--------:|:------------------:| --------------------------- |
| *filename* | `string` | :heavy_check_mark: | Full path or basename of a file. |
| *patterns* | `array` | | Expects a list of glob patterns that will be matched against the absolute paths of file system nodes. **Important**: symbolic links are always resolved. |
***
**Example**:
```json
{
"key": "ide.read",
"filename": "main.c"
}
```
### Response
* **Description**: Returns with the content of the selected file.
* **Subscribers**: *none*
```json
{
"key": "ide.read",
"scope": "websocket"
}
```
| Parameter | Type | Required | Description |
| ------------ |:--------:|:------------------:| --------------------------- |
| *filename* | `string` | :heavy_check_mark: | Basename or full path of a file. |
| *content* | `string` | :heavy_check_mark: | Content stored in the file. |
| *files* | `array` | :heavy_check_mark: | List of every readable file according to the current patterns. |
***
**Example**:
```json
{
"key": "ide.read",
"filename": "main.c",
"files": ["/home/main.c", "/home/not_main.c"],
"content": "#include <stdio.h>..."
}
```