Commit b2b4909
authored
Run Tasks (#1798)
### Description
This PR introduces the ability to run tasks within CodeEdit, utilizing a `.codeedit` folder to store task configurations. The goal is to enable users to create and manage tasks quickly and easily.
#### Simple Tasks Example:
```json
{
"tasks" : [
{
"command" : "go build",
"name" : "build",
}
]
}
```
#### Tasks with Environment Variables:
```json
"tasks" : [
{
"environmentVariables" : {
"database" : "maps"
},
"target" : "Docker",
"name" : "build",
"command" : "go build",
"workingDirectory" : "\/Users\/tommyludwig\/ScratchFolder\/task-tests"
}
],
```
#### Key Structures Introduced:
- `CETask`: Configuration for executing a task, including command and environment settings.
- `CEActiveTask`: Represents a running task with output and status (running, stopped, failed, succeeded). CETask is injected into CEActiveTask with essential information such as full command and environment variables.
- `CETaskManager`: Handles active tasks (run, renew, suspend, resume, terminate, interrupt).
- `CEWorkspaceSettings`: Holds workspace-specific settings data. Distinct from CEWorkspaceSettingsManager, which handles workspace settings management (e.g., saving, loading).
#### Active Task States:
An active task can be:
- `notRunning`: The task hasn't been interacted with yet.
- `stopped`: The task is currently suspended(paused).
- `running`: The task is actively running.
- `failed`: The task finished with an error code.
- `finished`: The task successfully completed.
#### Task Shell Options:
TaskShell provides various shells (e.g., bash, zsh, csh) for executing commands. Currently defaults to bash; future updates may include user settings for shell preference. Tasks are executed using `executeCommandWithShell`, utilizing a Swift `Process` to run commands within the user's environment plus additional variables from `CETask`. Output (`stdout` and stderr`) is captured using a `Pipe`.
> [!IMPORTANT]
> Reviewers, please pay close attention to the usage of classes vs. structs, as well as the naming conventions for classes, functions, and variables. Clear naming decisions now will save significant effort later.
### Related Issues
* closes #262
* closes #699
### Checklist
- [x] I read and understood the [contributing guide](https://github.com/CodeEditApp/CodeEdit/blob/main/CONTRIBUTING.md) as well as the [code of conduct](https://github.com/CodeEditApp/CodeEdit/blob/main/CODE_OF_CONDUCT.md)
- [x] The issues this PR addresses are related to each other
- [x] My changes generate no new warnings
- [x] My code builds and runs on my machine
- [x] My changes are all related to the related issue above
- [x] I documented my code
### Screenshots
<img width="1581" alt="Screenshot 2024-07-05 at 4 00 06 PM" src="https://github.com/CodeEditApp/CodeEdit/assets/83090745/8d303d9a-8d59-427e-979c-49a77471dc87">
<img width="1183" alt="Screenshot 2024-07-05 at 3 59 49 PM" src="https://github.com/CodeEditApp/CodeEdit/assets/83090745/a28e9ebd-3e07-4d15-a1fa-076808dcfd03">
<img width="1181" alt="Screenshot 2024-07-05 at 3 59 19 PM" src="https://github.com/CodeEditApp/CodeEdit/assets/83090745/52e49fc0-8907-4ed8-a875-cbf6b5239b07">
<img width="277" alt="Screenshot 2024-07-05 at 3 59 04 PM" src="https://github.com/CodeEditApp/CodeEdit/assets/83090745/2da86c33-180c-4f8a-8a64-ed80abd6deec">1 parent 00653f3 commit b2b4909
File tree
54 files changed
+2297
-858
lines changed- CodeEdit.xcodeproj
- CodeEditTests/Features
- ActivityViewer/TerminalEmulator/Shell
- Documents
- Tasks
- CodeEdit/Features
- ActivityViewer
- Notificaitons
- Tasks
- CEWorkSpaceSettings/CEWorkspaceSettings
- Models
- Views
- CEWorkspace
- Models
- Views
- Pages
- Documents
- Controllers
- WorkspaceDocument
- Tasks
- TerminalEmulator/Model
- UtilityArea/DebugUtility
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
54 files changed
+2297
-858
lines changedLarge diffs are not rendered by default.
Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
15 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
16 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
17 | 34 | | |
18 | 35 | | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
24 | 42 | | |
25 | 43 | | |
26 | 44 | | |
| |||
30 | 48 | | |
31 | 49 | | |
32 | 50 | | |
33 | | - | |
34 | | - | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
35 | 58 | | |
36 | 59 | | |
37 | 60 | | |
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
| 32 | + | |
31 | 33 | | |
32 | 34 | | |
33 | 35 | | |
| 36 | + | |
34 | 37 | | |
| 38 | + | |
35 | 39 | | |
36 | 40 | | |
37 | 41 | | |
| |||
Lines changed: 21 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
Lines changed: 32 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
Lines changed: 100 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
0 commit comments