You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The codebolt.taskplaner.addTask function takes a single parameter, task, which is a string representing the task you want to add. This function sends the task to the task planner system using a WebSocket message.
44
-
45
-
task (string): The description of the task to be added.
description: Executes a given command and returns the result.
6
5
7
6
Listens for messages from the WebSocket that indicate the output, error, or
8
7
finish state
@@ -13,35 +12,40 @@ cbparameters:
13
12
- name: command
14
13
typeName: string
15
14
description: The command to be executed.
15
+
- name: returnEmptyStringOnSuccess
16
+
typeName: boolean
17
+
description: Optional parameter to return empty string on success. Defaults to false.
16
18
returns:
17
19
signatureTypeName: Promise
18
-
description: >-
19
-
A promise that resolves with the command's output, error, or finish
20
-
signal.
21
-
typeArgs:
22
-
- type: ''
23
-
name: ''
20
+
description: A promise that resolves with the command's output or error.
21
+
typeArgs: []
24
22
data:
25
23
name: executeCommand
26
24
category: terminal
27
25
link: executeCommand.md
28
26
---
29
27
<CBBaseInfo/>
30
-
<CBParameters/>
31
-
32
-
### Examples
33
-
34
-
```js
35
-
36
-
// The codebolt.terminal.executeCommand function is likely used to execute a command in the terminal and retrieve the result.
37
-
38
-
constcmd=awaitcodebolt.terminal.executeCommand("npm i nodemon");
39
-
40
-
```
41
-
42
-
43
-
### Explaination
44
-
45
-
The codebolt.terminal.executeCommand function takes a single parameter, which is the command you want to execute in the terminal. It returns the result of the command execution. It has one parameter.
46
-
47
-
command (string): The command to be executed in the terminal. In this case, the command is "npm i nodemon", which installs the nodemon package using npm.
Executes a given command and keeps running until an error occurs.
4
+
description: Executes a given command and keeps running until an error occurs.
6
5
7
6
Listens for messages from the WebSocket and resolves the promise when an
8
7
error is encountered.
@@ -11,12 +10,13 @@ cbparameters:
11
10
- name: command
12
11
typeName: string
13
12
description: The command to be executed.
13
+
- name: executeInMain
14
+
typeName: boolean
15
+
description: Optional parameter to execute in main terminal. Defaults to false.
14
16
returns:
15
17
signatureTypeName: Promise
16
18
description: A promise that resolves when an error occurs during command execution.
17
-
typeArgs:
18
-
- type: reference
19
-
name: CommandError
19
+
20
20
data:
21
21
name: executeCommandRunUntilError
22
22
category: terminal
@@ -25,17 +25,22 @@ data:
25
25
<CBBaseInfo/>
26
26
<CBParameters/>
27
27
28
-
29
-
### Example
30
-
31
-
```js
32
-
33
-
codebolt.terminal.executeCommandRunUntilError("npm i nodemon")
34
-
35
-
```
36
-
37
-
### Explaination
38
-
39
-
The codebolt.terminal.executeCommandRunUntilError function takes a single parameter, command, which is a string representing the command you want to execute in the terminal. The function runs the specified command repeatedly until an error occurs.
40
-
41
-
command (string): The command to be executed in the terminal.
28
+
## Example
29
+
30
+
```javascript
31
+
// Run command until error occurs
32
+
try {
33
+
consterrorResult=awaitcodebolt.terminal.executeCommandRunUntilError('npm run dev');
34
+
console.log('Command stopped due to error:', errorResult);
0 commit comments