[envs] bash support for hooks

This commit is contained in:
odrling 2024-03-27 22:15:43 +01:00
parent f49894d096
commit f365a574f8
No known key found for this signature in database
GPG key ID: EC907F69A27A90C5
2 changed files with 5 additions and 7 deletions

View file

@ -119,7 +119,7 @@ odr_previous_dir=''
odr-defaultenv() {
[ "$PWD" = "${odr_previous_dir}" ] && return
export DETECTED_HOOKS=
DETECTED_HOOKS=()
odr_previous_dir="$PWD"
odr-load-python-venv
odr-loadenvrc
@ -138,8 +138,7 @@ enable-hook() {
}
enable-detected-hooks() {
hooks=(${(s/ /)DETECTED_HOOKS})
enable-hook $hooks
enable-hook "${DETECTED_HOOKS[@]}"
}
source_up() {

View file

@ -5,9 +5,9 @@
# think this stuff is worth it, you can buy me a beer in return. odrling
# -----------------------------------------------------------------------------
# shellcheck shell=zsh
# shellcheck shell=bash
function () {
{
local possible_hooks=(ruff isort black pyright)
local hooks=()
@ -16,6 +16,5 @@ function () {
grep $hook pyproject.toml &>/dev/null && hooks+=($hook)
done
export DETECTED_HOOKS="$hooks"
DETECTED_HOOKS+="${hooks[@]}"
}