14 lines
410 B
Bash
Executable file
14 lines
410 B
Bash
Executable file
#!/bin/zsh
|
|
source ${$(realpath "$0"):h:h}/lib/next-in-path.zsh
|
|
program="${0:a:t}"
|
|
if [[ $program == "envwrap" ]]; then
|
|
echo "Creating wrapper for $1 at ${0:a:h}/$1" >&2
|
|
ln -sr $(realpath "$0") ${0:a:h}/$1
|
|
exit 0
|
|
fi
|
|
|
|
envwrapconf=${XDG_CONFIG_HOME:-$HOME/.config}/envwrap/$program
|
|
[[ -e $envwrapconf ]] && source $envwrapconf
|
|
next=$(next-in-path "$program" $0)
|
|
if (( $? != 0 )); then exit 1; fi
|
|
$next "$@"
|