-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
17 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,26 @@ | ||
## About | ||
![img-2023-06-20-165418](https://github.com/imsnif/multitask/assets/795598/9877c93c-60a8-45ad-a113-354440741fd9) | ||
|
||
This is an example [Zellij][zellij] plugin in Rust. It can be used as a template to start developing your own plugins. | ||
This [Zellij][zellij] plugin is a "mini-ci". It opens your default `$EDITOR` in a new tab pointed to a `.multitask` file. Any command pasted to this file will run upon save. | ||
|
||
More about Zellij plugins: [Zellij Documentation][docs] | ||
Multitask will divide tasks into "steps" separated by an empty (whitespace) line. Running all commands in each step in parallel and only moving on to the next step if all commands exited successfully. You can re-run failed commands by pressing `ENTER` while focused on their pane, and if they exit successfully, the next step will be run. | ||
|
||
[zellij]: https://github.com/zellij-org/zellij | ||
[docs]: https://zellij.dev/documentation/plugins.html | ||
|
||
## Development | ||
|
||
## Inside Zellij | ||
![img-2023-06-14-143355](https://github.com/zellij-org/rust-plugin-example/assets/795598/d9e563dc-5d71-4e10-af5b-190365bdca3b) | ||
|
||
|
||
You can load the `./plugin-dev-workspace.kdl` file as a Zellij layout to get a terminal development environment: | ||
|
||
Either when starting Zellij: | ||
``` | ||
zellij --layout ./plugin-dev-workspace.kdl | ||
### Example | ||
``` | ||
*Note that in this case there's a small bug where the plugin is opened twice, it can be remedied by closing the oldest instance or loading with the new-tab action as secified below - this will be addressed in the near future* | ||
echo "I will be run first" | ||
echo "I will be run simultaneously to the line above" && sleep 2 | ||
Or from a running Zellij session: | ||
```bash | ||
zellij action new-tab --layout ./plugin-dev-workspace.kdl | ||
echo "I will be run 2 seconds later" | ||
echo "so will I!" | ||
``` | ||
|
||
## Otherwise | ||
[zellij]: https://github.com/zellij-org/zellij | ||
|
||
## Installation | ||
1. Download the `multitask.wasm` file from the latest release | ||
2. Place it in `~/zellij-plugins` | ||
3. From within Zellij, run `zellij action start-or-reload-plugin file:~/zellij-plugins/multitask.wasm` | ||
|
||
## Development | ||
|
||
1. Build the project: `cargo build` | ||
2. Load it inside a running Zellij session: `zellij action start-or-reload-plugin file:target/wasm32-wasi/debug/rust-plugin-example.wasm` | ||
3. Repeat on changes (perhaps with a `watchexec` or similar command to run on fs changes). | ||
Load the `dev.kdl` layout from inside zellij: `zellij action new-tab -l dev.kdl` or from outside Zellij with `zellij -l dev.kdl` |