#!/bin/zsh
autoload -Uz colors; colors
setopt no_unset warn_create_global extended_glob
(($+xtrace)) && (($xtrace)) && set -x
cd $0:h || exit
# helper that prints out error message and exits
die() {
print -r - "$fg_bold[red]*$reset_color $@" >&2
exit 1
}
fpath=( ${0:h}/functions $fpath )
autoload -Uz encode-args
name=$1
shift
target=$(encode-args "$@").$name \
|| die "Failed to generate target name"
./umount || exit $?
mkdir -p meta || exit $?
redo-ifchange meta/$target