i like the concept and the general implementation looks compact and neat.
> Only the ones that have an executable bit will be sourced.
setting executable flag to make it become sourced seems weird.
especially because +x is not even needed if it's sourced.
i would say merely the fact that a file is stored within
$XDG_CONFIG_HOME/vcsh/hook.d/init/ qualifies it as a hook. nothing more
is needed. no +x flag.
> What if you need to run a hook for zsh, only?
inside the hook file, you can do logic like:
if [ "$VCSH_REPO_NAME" = "vcsh" ]; then... fi
the fact that hooks are sourced (vs executed) is very powerful, it
gives the hook access to everything going on within vcsh. (all vars,
all defined functions, etc)
> For example if I want foo and bar hook for the init hook :
> With git hook approach, you would have to source foo and bar in the
> $VCSH_HOOK_D/init file.
what are foo and bar? different files, so the $VCSH_HOOK_D/init file sources
those 2 files?
vcs-home mailing list