/multitask

A mini-CI as a Zellij plugin

Primary LanguageRustMIT LicenseMIT

img-2023-06-20-165418

About

This Zellij plugin is a "mini-ci". It allows you to specify commands that will run in parallel, keeping track of completed commands and their exit status. Only progressing to the next step if all the commands in the previous step succeeded.

Did one command fail? No problem! Fix the issue, re-run it with ENTER and the pipeline will continue.

How does it work?

Multitask opens your default $EDITOR in a new tab pointed to a .multitask file. Any commands pasted to this file will run when you save it.

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.

Example

echo "I will be run first"
echo "I will be run simultaneously to the line above" && sleep 2

echo "I will be run 2 seconds later"
echo "so will I!"

Installation

  1. Download the multitask.wasm file from the release matching your installed Zellij version
  2. Place it in $HOME/zellij-plugins
  3. From within Zellij, run zellij action start-or-reload-plugin file:$HOME/zellij-plugins/multitask.wasm --configuration "shell=$SHELL,cwd=`pwd`"

Configuration options

Option Description
shell Sets the shebang of multitask file. $SHELL is the recommended value.
cwd Sets the current working directory for multitask. If no value is given, then the host of the zellij session is used.
multitask_file_name The name of the multitask file. This can be used to point to a multitask file that already exists or provide a specific name for a new multitask file. If no name is provided, then the multitask file name will be .multiask# where # is the plugin ID number.

Development

Load the dev.kdl layout from inside zellij: zellij action new-tab -l dev.kdl or from outside Zellij with zellij -l dev.kdl