mirror of
https://github.com/ivabus/pantry
synced 2024-11-26 18:25:08 +03:00
32 lines
641 B
Text
32 lines
641 B
Text
|
#!/bin/sh
|
||
|
|
||
|
set -e
|
||
|
|
||
|
find_git_command() {
|
||
|
for arg in "$@"; do
|
||
|
case $arg in
|
||
|
-*);;
|
||
|
*)
|
||
|
echo $arg
|
||
|
return # found the command!
|
||
|
esac
|
||
|
done
|
||
|
}
|
||
|
|
||
|
libexec="$(cd "$(dirname "$0")/.." && pwd)"/libexec
|
||
|
|
||
|
# extract the git subcommand
|
||
|
cmd=$(find_git_command "$@")
|
||
|
|
||
|
if [ -z "$cmd" ]; then
|
||
|
exec "$libexec/git" "$@"
|
||
|
elif [ -x "$libexec/git-$_CMD" -a -f "$libexec/git-$cmd" ]; then
|
||
|
exec "$libexec/git" "$@"
|
||
|
elif type "git-$cmd" >/dev/null 2>&1; then
|
||
|
exec "$libexec/git" "$@"
|
||
|
elif command -v pkgx >/dev/null 2>&1 && pkg=$(pkgx --provider git-$cmd); then
|
||
|
exec pkgx +$pkg "$libexec/git" "$@"
|
||
|
else
|
||
|
exec "$libexec/git" "$@"
|
||
|
fi
|