A module is a subdirectory of the modules
directory.
The files install.sh
, update.sh
, and remove.sh
correspond to the install
, update
, and remove
actions, respectively. They contain the logic of your module. These files are optional; only define the actions you need. You can add any other files your logic requires (e.g., .vimrc
).
Note
Module scripts are executed local to the module, not the provo
directory (e.g., cp .vimrc ~
works).
Provo executes each module in a separate subshell. Any error code returned or exited by a module is propagated to the framework and ultimately returned by provo
.
Provo framework uses the following error codes:
# Error codes
readonly ERR_NOT_FOUND=2 # ENOENT: No such file or directory
readonly ERR_INVALID_ARGUMENT=22 # EINVAL: Invalid argument
readonly ERR_MISSING_DEPENDENCY=65 # ENOPKG: Package not installed
Each module action script declares a list of system-level dependencies required for its execution. These dependencies are specified as command names (e.g., git
, wget
), not module names.
Before executing an action, Provo verifies the presence of these dependencies on the system. If any required dependency is not found, the action is skipped.
Example (update.sh
):
...
REQUIREMENTS=(
zsh
git
)
...
Important
- Action script names must be one of
install.sh
,update.sh
, orremove.sh
. - They must have the
if [[ "$RUN_MODULE" == true ]]; then <your logic> fi
structure. All logic executed upon sourcing your action file must go within these guards. - It's strongly recommended to include a
REQUIREMENTS=()
list, even if it's empty.
Refer to the simple:install.sh
script for an example.
provo
sources action files to pull and check the REQUIREMENTS
list before executing the action. The [[ "$RUN_MODULE" == true ]]
guards prevent your script logic from being executed twice.
-
(Prerequisite) Fork
provo
. -
Create a new directory for your module:
mkdir modules/<module-name>
-
Add your module scripts and configuration files inside this directory.
-
(Optional) Update the
provo
script if you want to hardcode your new module. -
Commit and push your changes:
git add modules/<module-name> git commit -m "Add <module-name> module" git push origin <branch-name>