Compare commits
7 commits
16b21a253a
...
2e746a35b2
Author | SHA1 | Date | |
---|---|---|---|
odrling | 2e746a35b2 | ||
odrling | 48bd8e09df | ||
odrling | beee1f3bb0 | ||
odrling | 54451a841c | ||
odrling | 21d50e89f8 | ||
odrling | 16ac82622d | ||
odrling | dd82561a91 |
|
@ -36,6 +36,8 @@
|
|||
longpaths = true
|
||||
logallrefupdates = true
|
||||
hooksPath = "~/.config/git/hooks"
|
||||
untrackedcache = true
|
||||
fsmonitor = true
|
||||
[pull]
|
||||
ff = "only"
|
||||
rebase = "merges"
|
||||
|
@ -51,7 +53,8 @@
|
|||
pushall = !git remote | xargs -n 1 git push --all
|
||||
tlc = clone --filter tree:0
|
||||
blc = clone --filter blob:none
|
||||
|
||||
[rerere]
|
||||
enabled = true
|
||||
[commit]
|
||||
cleanup = scissors
|
||||
gpgsign = true
|
||||
|
@ -61,7 +64,8 @@
|
|||
[tag]
|
||||
gpgsign = true
|
||||
sort = -taggerdate
|
||||
|
||||
[column]
|
||||
ui = auto
|
||||
[pager]
|
||||
difftool = true
|
||||
|
||||
|
|
|
@ -35,3 +35,5 @@ runif "ruff" ruff check .
|
|||
runif "pyright" pyright .
|
||||
runif "clangformat" 'fd --glob \*.c | xargs clang-format -Werror -n'
|
||||
runif "gofmt" '[ "$(gofmt -l . | wc -l)" -eq 0 ] || (gofmt -l -d .; exit 1)'
|
||||
runif "muonfmt" "fd meson.build | xargs muon fmt -q"
|
||||
runif "muon" "muon analyze"
|
||||
|
|
|
@ -106,7 +106,7 @@ odr-load-python-venv() {
|
|||
return 1
|
||||
fi
|
||||
|
||||
[ -f ~/.zsh/envs/python ] && source ~/.zsh/envs/python
|
||||
odr-detect-python-hooks
|
||||
}
|
||||
|
||||
odr-display-hooks() {
|
||||
|
@ -115,6 +115,25 @@ odr-display-hooks() {
|
|||
git config --get-regexp odrhooks\. 2>/dev/null
|
||||
}
|
||||
|
||||
odr-detect-python-hooks() {
|
||||
local possible_hooks=(ruff isort black pyright)
|
||||
local hooks=()
|
||||
|
||||
for hook in ${possible_hooks[@]}; do
|
||||
grep $hook pyproject.toml &>/dev/null && odr-add-detected-hooks $hook
|
||||
done
|
||||
}
|
||||
|
||||
odr-add-detected-hooks() {
|
||||
for name in "${@}"; do
|
||||
[ "$(git config odrhooks.${name})" != 1 ] && DETECTED_HOOKS+=("${name}")
|
||||
done
|
||||
}
|
||||
|
||||
odr-detect-hooks() {
|
||||
[ -f "meson.build" ] && odr-add-detected-hooks muon muonfmt
|
||||
}
|
||||
|
||||
odr_previous_dir=''
|
||||
|
||||
odr-defaultenv() {
|
||||
|
@ -123,6 +142,7 @@ odr-defaultenv() {
|
|||
odr_previous_dir="$PWD"
|
||||
odr-load-python-venv
|
||||
odr-loadenvrc
|
||||
odr-detect-hooks
|
||||
odr-display-hooks
|
||||
}
|
||||
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
# -----------------------------------------------------------------------------
|
||||
# "THE BEER-WARE LICENSE" (Revision 42):
|
||||
# <florianbadie@odrling.xyz> wrote this file. As long as you retain this notice
|
||||
# you can do whatever you want with this stuff. If we meet some day, and you
|
||||
# think this stuff is worth it, you can buy me a beer in return. odrling
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
# shellcheck shell=bash
|
||||
|
||||
{
|
||||
local possible_hooks=(ruff isort black pyright)
|
||||
local hooks=()
|
||||
|
||||
for hook in ${possible_hooks[@]}; do
|
||||
[ "$(git config odrhooks.$hook)" != 1 ] &&
|
||||
grep $hook pyproject.toml &>/dev/null && hooks+=($hook)
|
||||
done
|
||||
|
||||
DETECTED_HOOKS+="${hooks[@]}"
|
||||
}
|
Loading…
Reference in a new issue