From e2d0e538aca5fae04720ca4aef5ad8f59bcc22ec Mon Sep 17 00:00:00 2001 From: ni-richard Date: Wed, 11 Sep 2019 17:12:47 +0200 Subject: [PATCH] Created ide.read (markdown) --- ide.read.md | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 ide.read.md diff --git a/ide.read.md b/ide.read.md new file mode 100644 index 0000000..b3d9a85 --- /dev/null +++ b/ide.read.md @@ -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 ..." +} +``` \ No newline at end of file