Skip to content

Callback

Nat! edited this page Feb 14, 2018 · 5 revisions

Each patternfile has the form <digits>-<callback>--<category>.

The callback identifier gets the string '-callback' appended to form the name of the callback executable. This executable must be located in ${MULLE_MONITOR_DIR}/bin.

The executable will be called with the following arguments and environment

Number Argument Description
$1 filepath The file that has changed
$2 action One of three possible strings: "create" "modify" "update"
$3 category The optional category of the matching file

Some environment variables will be available:

Variable Description
PWD This variable and the working directory will be the project folder
MULLE_MONITOR_DIR Location of the .mulle-monitor folder
MULLE_MONITOR_ETC_DIR Location of the etc folder
MULLE_MONITOR_MATCH_DIR Location of the match.d folder
MULLE_MONITOR_IGNORE_DIR Location of the ignore.d folder
MULLE_MONITOR_LIBEXEC_DIR libexec directory of mulle-monitor
MULLE_BASHFUNCTIONS_LIBEXEC_DIR libexec directory of mulle-bashfunctions

A very simple callback would be:

#! /bin/sh

# could update a Makefile here maybe

# return task
echo "hello"

You can manage callbacks using the mulle-monitor callback command.

Clone this wiki locally