[envs] bash support for hooks
This commit is contained in:
parent
f49894d096
commit
f365a574f8
|
@ -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() {
|
||||
|
|
|
@ -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[@]}"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue