git:zsh-autoload: Use relative scripts/ folder

This makes it a bit more agnostic to the type of scripts being used.
This commit is contained in:
2025-09-12 14:46:55 +02:00
parent bb7ef3769d
commit 9c1e3f4679

View File

@@ -2,8 +2,9 @@
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
# Copyright (c) 2025 Julian Prein # Copyright (c) 2025 Julian Prein
# #
# Meant to be used in git aliases to launch an autoloadable zsh function in the # Meant to be used by git aliases to easily launch an external script from the
# correct directory. # ./scripts/ collection through its basename and in the correct directory (i.e.
# GIT_PREFIX).
if [ $# -eq 0 ]; then if [ $# -eq 0 ]; then
printf >&2 "Usage: %s <function>\n" "$(basename "$0")" printf >&2 "Usage: %s <function>\n" "$(basename "$0")"
@@ -12,7 +13,7 @@ fi
name="$1" name="$1"
shift shift
BASE="${XDG_CONFIG_HOME:-$HOME/.config}/zsh/autoload/git" BASE="$(dirname "$(realpath "$0")")/scripts"
# In git aliases, shell commands are executed from the top-level directory of # In git aliases, shell commands are executed from the top-level directory of
# the repo. GIT_PREFIX contains the original directory relative to the # the repo. GIT_PREFIX contains the original directory relative to the